resetting bxSlider

前端 未结 9 1638
滥情空心
滥情空心 2021-01-06 06:45

I took a different direction with a carousel I implemented, opting for bxSlider instead of jCarousel. This is for an image gallery I am building http://rjwcollective.com/equ

9条回答
  •  灰色年华
    2021-01-06 07:42

    I was writing a program which make a bunch of AJAX calls on a timer and displays the results in a bxslider and I also ran into a problem where the bxslider wasn't refreshing.This is how I solved it:

    var $slider = null;
    

    And inside the portion of code where you need to initialize or refresh the slider do this:

    if ($slider == null) {
        $slider = $('.sliderDashboard').bxSlider({
            slideWidth: 200,
            minSlides: 1,
            maxSlides: 1,
            slideMargin: 10
        });
    }
    else {
        $slider.reloadSlider();
    }
    

提交回复
热议问题