jquerybxslider

BxSlider4 first "next" slide arrow


I have a question on how to hide next arrow in first slide if no other slides exists yet. My slides are generated dynamically and everything works great. All I would like to achieve is to add class "disabled" to next arrow in controls if there is only 1 slide.

Thank you

Here is what I use but id doesn't do the job :(

$(document).ready(function(){

$('.bxslider').bxSlider({
  minSlides: 1,
  maxSlides: 1,
  slideWidth: 214,
  slideMargin: 5,
  infiniteLoop: false,
  hideControlOnEnd: true,
  pager: false  
}); 

if(slider.getSlideCount() < 0){
        slider.controls.next.addClass('disabled');
    }
});

Solution

  • have you tried:

    if($('ul.bxslider li').length == 1){
        $('.bx-next').addClass('disabled');
    }
    

    If you are having sliders in ul li then check for the length of the li's if that is one then disable the next btn.