jQuery Cycle plugin - pause/resume weird behavior

▼魔方 西西 提交于 2019-12-06 03:44:20

I had the same problem, pause and resume were not working. It appeared I had installed the lite version, with the full/complete version it's working.

You didn't show your code for sending the pause command. Something is definitely wrong there because pause does NOT reset the slideshow to the first slide.

Also, you don't need to keep track of the slide index yourself. The third arg to the before/after callbacks is an options object that has the internal state of the slideshow. On that object you will find 'currSlide' and 'slideCount' properties, among many others.

I know this is an old question, but I just had the same problem. The way I got around it was to simply create my own function to pause and resume the slideshow with JQuery's hover events.

As Eric pointed out in a few comments, a related issue is that the plugin's pause option only allows hovering over the IMG element to pause the slideshow, so if you've got anything over your images, like a pager or any decorative elements, then you are boned.

So, I put my decorative elements, banner (which I called "#banner") and pager all into a div called "#banner-container" and then applied this code to fix my problem:

$('div#banner-container').hover(function(){
   if(!$(this).hasClass('paused')){
       $(this).addClass("paused");
       $('div#banner').cycle("pause")
   }
},function(){
   if($(this).hasClass('paused')){
       $(this).removeClass("paused");
       $('div#banner').cycle("resume")
   }
});

The problem is in the JQuery Cycle Plugin version: the "lite" version ignores the pause/resume commands. Using the full version could solve the problem.

EDIT: Sorry, i was wrong: i tried both versions but had the same issue using the full version.

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