Javascript 停止动画对象-jQuery&;spritly插件
我正在尝试设置这个动画div,以便它在屏幕上滚动一次,然后停止,除非重新加载页面Javascript 停止动画对象-jQuery&;spritly插件,javascript,jquery,animation,spritely,Javascript,Jquery,Animation,Spritely,我正在尝试设置这个动画div,以便它在屏幕上滚动一次,然后停止,除非重新加载页面 // JavaScript Document jQuery(document).ready(function() { $('#far-clouds').pan({ fps: 20, no_of_frames: 24, on_first_frame: function(obj) { obj.spState(1); // change to state 1 (fir
// JavaScript Document
jQuery(document).ready(function() {
$('#far-clouds').pan({
fps: 20,
no_of_frames: 24,
on_first_frame: function(obj) {
obj.spState(1); // change to state 1 (first row) on frame 1
},
on_last_frame: function(obj) {
obj.spStop(); // stop the animation on the last frame
},
on_frame: { // note - on_frame is an object not a function
19: function(obj) { // called on frame 19
obj.spState(2); // change to state 2 (row 2) on frame 19
},
16: function(obj) { // called on frame 16
obj.spState(3); // change to state 3 (row 3) on frame 16
}
}
});
$('#near-clouds').pan({
fps: 20,
no_of_frames: 24,
on_first_frame: function(obj) {
obj.spState(1); // change to state 1 (first row) on frame 1
},
on_last_frame: function(obj) {
obj.spStop(); // stop the animation on the last frame
},
on_frame: { // note - on_frame is an object not a function
19: function(obj) { // called on frame 19
obj.spState(2); // change to state 2 (row 2) on frame 19
},
16: function(obj) { // called on frame 16
obj.spState(3); // change to state 3 (row 3) on frame 16
}
}
});
});
JSFIDDLE:
我使用的插件是Sprily-此版本的文档说明,您可以通过引用动画应该停止的帧来设置obj.stop。obj是远云。它是.pan(平移)作为动画函数在屏幕上的显示,由插件脚本处理。然后我调用函数在第19帧停止。这根本不起作用。它继续循环。我似乎找不到这样做的理由。而不是使用常规Jquery回调来停止它。我肯定我还能做什么
因此,任何援助都将是巨大的。谢谢