admin管理员组文章数量:1318573
jQuery Reel () is an excellent jQuery plugin for creating nice 360-views of things.
There are events you can trigger to play, stop and pause the animation, and also to detect what frame you are currently on (.reel("frame")
) but I can't really work out how to put them together to create a link which plays the reel of a specific frame, and then stops. Any suggestions?
jQuery Reel (http://jquery.vostrel.cz/reel) is an excellent jQuery plugin for creating nice 360-views of things.
There are events you can trigger to play, stop and pause the animation, and also to detect what frame you are currently on (.reel("frame")
) but I can't really work out how to put them together to create a link which plays the reel of a specific frame, and then stops. Any suggestions?
1 Answer
Reset to default 9You can "play"
it, bind to "frameChange"
event to check for the target frame and when that is reached, "stop"
it. Something like this:
$('#your_reel_image')
.trigger('play')
.bind('frameChange', function(){
if ($(this).reel('frame') == target_frame){
$(this).trigger('stop');
}
});
Just be aware of the fact, that on slower devices like mobiles, some frames may be skipped in order to keep up with the required animation speed.
You also receive the frame
as third event handler argument to save yourself the additional .reel()
call inside the handler, so the above can be refactored to:
$('#your_reel_image')
.trigger('play')
.bind('frameChange', function(e, depr_frame, frame){
if (frame == target_frame){
$(this).trigger('stop');
}
});
EDIT:
Since version 1.3, you can replace the above solution with calling just:
$('#your_reel_image').trigger('reach', target_frame);
Reel will animate the shortest path towards the given frame and stop there.
本文标签: javascriptHow to play jQuery Reel to a specific frame and stop thereStack Overflow
版权声明:本文标题:javascript - How to play jQuery Reel to a specific frame and stop there? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742048364a2417926.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论