我使用这个插件:http://www.spritely.net/ 谁能告诉我为什么变量$ sprite不会重新执行吗?jquery spritefy暂停并重新启动
function animate_header() {
var $sprite = $('#header')
.sprite({
fps: 30,
no_of_frames: 4,
// the following are optional: new in version 0.6...
start_at_frame: 1,
rewind: false,
on_last_frame: function(obj) {
// you could stop the sprite here with, e.g.
obj.spStop();
}
})
.active();
}
var init = setInterval("animate_header()", 1000);
我也试过这样:
function animate_header() {
$('#header')
.sprite({
fps: 30,
no_of_frames: 4,
// the following are optional: new in version 0.6...
start_at_frame: 1,
rewind: false,
on_last_frame: function(obj) {
// you could stop the sprite here with, e.g.
obj.spStop();
}
})
.active();
}
var init = setInterval("animate_header()", 1000);
函数本身执行的每一秒。但精灵不。
什么。主动( )?我不认为它是一种精辟的方法(或者是一个jQuery函数?)。 – orolo
对不起,我明白了。你有没有尝试调用.destroy(),然后重新运行? – orolo