admin管理员组文章数量:1426072
I'm using jQuery jCarousel for a slider, after few mins I found the way to stop the slider on mouseover, but the problem is it doesn't stop immediately on mouseover, it only stop at the end of the image set (3 images in my demo). However it does start immediately on mouse out. I'm new javascript stuff and couldn't do much by diving to it's source. :(
My Current Code -
Thank You
I'm using jQuery jCarousel for a slider, after few mins I found the way to stop the slider on mouseover, but the problem is it doesn't stop immediately on mouseover, it only stop at the end of the image set (3 images in my demo). However it does start immediately on mouse out. I'm new javascript stuff and couldn't do much by diving to it's source. :(
My Current Code - http://bit.ly/ijNcow
Thank You
Share Improve this question asked Mar 20, 2011 at 12:05 Sahan H.Sahan H. 4727 silver badges14 bronze badges 1- This issue has been fixed. Please take a look: code.google./p/jcarausel-lite-pause-on-hover-fixed – saikatbiswas82 Commented May 23, 2012 at 15:24
2 Answers
Reset to default 4Often, we manage a jCarousel by using .click()
. In this case - you can use the following code to stop the animation:
itemLoadCallback: {
onBeforeAnimation: function(jc, state) {
jc.lock();
}
}
The jc.lock()
or jc.unlock()
functions stop and resume the animation, respectively.
The jCarousel code uses two timers that I can see. The timer wrapped in jQuery's animation support and a timer that scrolls the underlying list forward by one item. Your page's code clears the second timer by calling carousel.stopAuto()
, but not the animation timer. Hence the animation continues until the next item has been scrolled in (in essence, that the second item reaches the topmost position).
To clear that one you'll have to also call jQuery's stop()
function on the carousel element. At a guess (no, I have not tested this), you should call
$('#listing').stop(true);
Having said that, I'm not sure what will happen to the user experience if you've paused half way through an animation and then started it up again (by moving the mouse out, say). The animation won't start up where you left off, that's for sure. I would also guess that the carousel will assume that the animation pleted normally and you'll get a "jump effect" as it sets the top item properly in place.
本文标签: javascriptjCarousel stop immediately on mouseoverStack Overflow
版权声明:本文标题:javascript - jCarousel stop immediately on mouseover - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745407853a2657330.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论