Search code examples
jquerybxslider

How to make two bxslider instances move at once? I tried changing delays, pauses and auto delays but no luck. :(


Here's my code

$('.bxslider').bxSlider({
    mode: 'horizontal',
    auto: true,
    controls: false,
    speed:500,
    pause: 2000,
    autoDelay:0
  });

  $('.names-slider').bxSlider({
    mode: 'horizontal',
    auto: true,
    controls: false,
    speed:500,
    pause: 2000,
    autoDelay:0
  });

Solution

  • you can initialize you bxslider with auto:false

    var sliderone = $('.bxslider').bxSlider({
        auto: false
    });
    
    var slidertwo = $('.names-slider').bxSlider({
        auto: false
    });
    

    and then using setTimeout or setInterval to run the goToNextSlide function for both the sliders at the same time

    var moveSlider = function(){
        sliderone.goToNextSlide();
        slidertwo.goToNextSlide();
    }
    
    setTimeout(moveSlider,2000);