getgrav / grav-plugin-lightslider

Grav LightSlider Plugin
https://getgrav.org
MIT License
14 stars 15 forks source link

Not able to disable the lightSlider function #5

Closed rajagh closed 9 years ago

rajagh commented 9 years ago

Hi, I'm initialization the function on true condition on select drop down, but not able to destroy the same on else condition.

pls help me.

w00fz commented 9 years ago

I'm not sure I understand what you are trying to do, mind sharing some code?

rajagh commented 9 years ago

I'm calling below function on select dropdown/onchange on ture condition lightSlider get initialized and other hand it's destroy/ de-initialized on else condition. ///////////////////////////////////////////////////////////// var galleryPangination = function (id){

//$(id).lightSlider().init();
var galleryLenght = $(id).find('li').length;
console.log("galleryLenght "+ galleryLenght);
if(galleryLenght > 3){

$(".lSAction").css("display","block");
alert("pp")
var slidbar = $(id).lightSlider({
onBeforeStart: function() { alert("before");  },
mode:"slide",
pager: false,
 rtl:false,

item:3, slideMove:1, controls:false, 'prevnext': true,

vThumbWidth: 300, currentPagerPosition : 'middle', preload : 1, speed : 600, hideControlOnEnd: true, responsive :[], freeMove: false, swipeThreshold:40, enableTouch:false, enableDrag:false, freeMove:false, swipeThreshold: 40, auto: false, loop: false,

}); $('.lSPrev').click(function(){
slidbar.goToPrevSlide();

               });

$('#lSNext').click(function(){
slidbar.goToNextSlide();

               });

}else{

    $(".lSAction").css("display","none");
      slidbar.goToSlide(1);
    //$(id).destroy();

     }

}