bx slider start/stop function

谁说胖子不能爱 提交于 2019-12-05 17:26:19
Kate Houst

I don't know if you still need an answer to this, but if you update your code to this, it should work:

var slider = $('#bxslider').bxSlider({

  auto: true,

  controls: false

});

$('#go-prev').click(function(){ 

  slider.goToPreviousSlide();

  slider.startShow(); //added this line

  return false;
});

  $('#go-next').click(function(){

    slider.goToNextSlide();

    slider.startShow(); //added this line

    return false;

  });

  $('#my-start-stop').click(function(){

      /* added a class to your #my-start-start a tag called "stopShow", note: would recommend that you also change the text to say "Stop" when the show is active and "Start" when the show is not. :) */

      if($('#my-start-stop').attr('class') == 'stopShow'){

          slider.stopShow();

          $('#my-start-stop').removeClass('stopShow');

      } else {

          slider.startShow();

          $('#my-start-stop').addClass('stopShow');


      }


    return false;
  });
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!