我的代码需要一些帮助。我已经定义了一个带回调函数的无限animatine。无限动画对我来说非常好,但是:
我需要第二个动画还是?我认为问题将在最后一个参数($(this).css(...))。这样就可以快速转移到......不太好。
$(function () {
var moveBasic = function () {
$('ul#softfacts div.basic').delay(1000).animate({
'margin-left': '+=5px'
}, 1000, 'linear', function () {
$(this).css({
'margin-left': '+=5px'
});
moveBasic();
});
}
moveBasic();
});
},
答案 0 :(得分:1)
再次使用animate()
:
$(this).animate({
marginLeft: '-=5px'
}).promise().done(function () {
moveBasic()
});
答案 1 :(得分:0)
这指的是全局对象。尝试使用$('ul#softfacts div.basic')而不是这个。