I have two and more buttons with same class to destroy and rebuild the lightSlider script.
The CMS where I built it, is loading the images and ajax. As the javascript is loaded by ready it does not allow me to trigger the button for a second time.
What would be the way to destroy and rebuild it after ajax is loaded (ajaxComplete)?
$(document).ready(function() {
var slider = $('#publicMethods').lightSlider({
slideMargin:4,
slideWidth:200,
loop:false
});
$('.load').click(function(){
slider.destroy();
});
$('.load').click(function(){
if (!slider.lightSlider) {
slider = $('#publicMethods').lightSlider({
slideMargin:4,
slideWidth:200,
loop:false
});
}
});
});