Any way to make jQuery cycle not loop when reaching the end or the beginning?

我的未来我决定 提交于 2019-12-07 05:34:25

问题


I realize that the plugin is called CYCLE because it cycles throgh the element of the list. But what I like most about it is its flexibility, so I was wondering if there is any way to make the plugin not cycle. So if you try to go to the previous slide when on the first one, or to the next slide when on the last one, it just stops.

I've been reading through the options and the code but cant find the solution


回答1:


http://jquery.malsup.com/cycle/options.html

Check out the nowrap property. (See http://jquery.malsup.com/cycle/nowrap2.html) Set it to nowrap: 1 and your show will stop after each slide has been played 1 time. This is clearly the option you'd need.




回答2:


Using this slider: http://slidesjs.com/

The y() function in the slides.js pauses the slider. So if you wanted to stop on slide 4...

animationComplete: function(current){ 
    if(current == 4) { 
      y();  
    } else {    
      /* default animate slide code */
    };                       
},


来源:https://stackoverflow.com/questions/6944312/any-way-to-make-jquery-cycle-not-loop-when-reaching-the-end-or-the-beginning

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