Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery bx滑块启动/停止功能_Jquery_Slider_Bxslider - Fatal编程技术网

Jquery bx滑块启动/停止功能

Jquery bx滑块启动/停止功能,jquery,slider,bxslider,Jquery,Slider,Bxslider,我正在使用bxslider插件,并为上一个和下一个函数创建了一些外部控件,尽管我似乎不知道如何对启动/停止控件执行同样的操作 基本上,我想使用它作为滑块的播放/暂停功能 有没有人有过使用这个插件的经验 到目前为止,在启动/停止功能不起作用的情况下,我的情况如下: 此外,我希望滑块“自动”播放,以及有这个外部控制。我刚刚注意到,单击我的任何链接似乎都会禁用自动播放,我必须刷新页面才能将其取回。我不知道您是否仍然需要对此问题的答案,但如果您将代码更新为此,它应该可以工作: var slider =

我正在使用bxslider插件,并为上一个和下一个函数创建了一些外部控件,尽管我似乎不知道如何对启动/停止控件执行同样的操作

基本上,我想使用它作为滑块的播放/暂停功能

有没有人有过使用这个插件的经验

到目前为止,在启动/停止功能不起作用的情况下,我的情况如下:


此外,我希望滑块“自动”播放,以及有这个外部控制。我刚刚注意到,单击我的任何链接似乎都会禁用自动播放,我必须刷新页面才能将其取回。

我不知道您是否仍然需要对此问题的答案,但如果您将代码更新为此,它应该可以工作:

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;
  });
值得补充的是,最新版本的BXSlider上不存在stopShow()和startShow()。您应该改为使用
stopAuto()
startAuto()