bx slider : how to disable slide show when only one image is present

Vysakh V K picture Vysakh V K · Jul 9, 2014 · Viewed 16.5k times · Source

I am using bxslider to create a slideshow of my images. The images are updating dynamically. My problem is the sideshow fade-in and fade-out work even only one image is present. How can I stop this ?

bxslider options are

   var coverSlider = $('.bxslider').bxSlider({
        auto: true,
        minSlides: 1,
        maxSlides: 1,
        pager: false,
        speed: 500,
        pause: 3000,
        autoHover: true,
        mode: 'fade',
        controls: false
   })

I am using reload method to update the slider when a new image is appends or removes

 coverSlider.reloadSlider();

Answer

Sonjoe picture Sonjoe · Jan 28, 2015

this helps me:

$(document).ready(function(){
  $('.bxslider').bxSlider({
    mode: 'fade',
    auto: ($(".bxslider li").length > 1) ? true: false,
    pager: ($(".bxslider li").length > 1) ? true: false,
    controls: false
  });
});