bxSlider not working automatically

user961627 picture user961627 · Jun 3, 2013 · Viewed 22.1k times · Source

I want the bxSlider to automatically start the slideshow without the user clicking on it. This is my code (which isn't working):

slider = $('.slider1').bxSlider({
    slideWidth: 1012,
    slideHeight:200,
    minSlides: 1,
    slideMargin: 0,
    controls: false,
    auto: true,
    autoStart: true
});
slider.startAuto();

What's wrong with this? What happens is that images do load, but it never autoscrolls, the user always have to choose one of the pager dots to manually scroll through. What's wrong with my code?

Answer

Raa picture Raa · Jan 12, 2015

You should use

 $(document).ready(function(e) {    });

or

 $(window).ready(function(e) {    });

in between the code.

so the correct one should be,

 $(document).ready(function(e) {
    $('.slider1').bxSlider({
        slideWidth: 1012,
        slideHeight:200,
        minSlides: 1,
        slideMargin: 0,
        controls: false,
        auto: true,

    });
    });

hope this will help you...!