1

Currently I have the following in my $(document).ready(function() AFTER the initialization for the sliders themselves.

This code represents 3 sliders and it works, but I have more sliders.

  • When I add more than 4-5+ sliders then it doesn't work (it works on some, not others)

Is there a way to add a bunch of sliders here?

 setInterval(function(){

   var owldataTS = $(".testimonial-slider").data('owlCarousel');
   owldataTS.updateVars();

   var owldataMS = $(".multi-slider").data('owlCarousel');
   owldataMS.updateVars();

   var owldataMM = $(".mini-multi").data('owlCarousel');
   owldataMM.updateVars();


},1500);

BTW: this is used for when a page size changes without a re-size of the viewport, like toggling a sidebar or tab content.

4

1 に答える 1

3

スライダーに共通のクラスを指定して、次のことを行うことができます。

setInterval(function(){
 $(".common-class").each(function(){
    $(this).data('owlCarousel').updateVars();
 });
},1500);
于 2014-10-12T15:30:27.090 に答える