Created
September 28, 2015 14:50
-
-
Save carloscabo/0a6b76537eeb6bf4ee82 to your computer and use it in GitHub Desktop.
Destroy flexslider carousel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function flexdestroy(selector) { | |
var $els = $(selector); | |
$els.each(function() { | |
var $el = $(this); | |
var $elClean = $el.clone(); | |
$elClean.find('.flex-viewport').children().unwrap(); | |
$elClean | |
.removeClass('flexslider') | |
.find('.clone, .flex-direction-nav, .flex-control-nav') | |
.remove() | |
.end() | |
.find('*').removeAttr('style').removeClass(function (index, css) { | |
// If element is SVG css has an Object inside (?) | |
if (typeof css === 'string') { | |
return (css.match(/\bflex\S+/g) || []).join(' '); | |
} | |
}); | |
$elClean.insertBefore($el); | |
$el.remove(); | |
}); | |
} | |
// flexdestroy('#slider'); // Replace with your selector/s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment