bx滑块启动/停止function

我正在使用bxslider插件,并为前一个和下一个函数创建了一些外部控件,虽然我似乎无法弄清楚如何对启动/停止控件执行相同的操作。

基本上我想用它作为滑块的播放/暂停function。

有没有人有这个插件的经验?

这是我到目前为止没有启动/停止function的工作:

http://jsfiddle.net/WaWLN/1/

此外,我希望滑块“自动”播放,以及具有此外部控件。 我只是注意到点击我的任何链接似乎禁用了自动播放,我必须刷新页面才能恢复它。

我不知道你是否还需要这个答案,但如果你将代码更新为此,它应该可以工作:

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; });