I have a little animation that makes elements bob up and down. Each element bobs at a slightly different speed and amount. I m using Jquery Timers (http://plugins.jquery.com/project/timers) everyTime function to infinitely loop the animation.
我已成功地走了这些要素,以克服和缩小,但我可以不让他们停止使用停职。
这就是我迄今为止所做的事情:
function randomFromTo(from, to){
return Math.floor(Math.random() * (to - from + 1) + from);
}
function bobbing(command){
if(command== start ){
$("#scroller .feature-headline").each(function (i) {
$(this).everyTime(1, bobbing , function (){
var bobAmount = randomFromTo(5, 10);
var bobSpeed = randomFromTo(1200, 2000);
$(this).animate ({marginTop: bobAmount}, bobSpeed, linear ).animate ({marginTop: 0}, bobSpeed, linear );
});
});
} else {
$("#scroller .feature-headline").each(function (i) {
$(this).stopTime( bobbing );
});
}
}
在什么地方我错了?