Jquery 创建一个随机的;“左”;每次此动画循环时的位置

Jquery 创建一个随机的;“左”;每次此动画循环时的位置,jquery,Jquery,我有一些降落伞的动画,我想添加一些随机的。每次它循环(使用jquery定时器插件),我基本上希望它从一个随机的左侧位置运行 我可以用以下函数创建我的随机数 function randomLeft() { var randomNumber = Math.floor(Math.random() * 101); return randomNumber+'%'; } 我有我的循环: $('#parachute_wrap img').everyTime ( 11, function (){

我有一些降落伞的动画,我想添加一些随机的。每次它循环(使用jquery定时器插件),我基本上希望它从一个随机的左侧位置运行

我可以用以下函数创建我的随机数

function randomLeft() {
var randomNumber = Math.floor(Math.random() * 101);
return randomNumber+'%';
}
我有我的循环:

$('#parachute_wrap img').everyTime ( 11, function (){
          $('#parachute_wrap img')
          .animate({top:"1000px"},25000)
          .animate({top:"-100px"});
});
我试着做了以下几点:

$('#parachute_wrap img').everyTime ( 11, function (){
          $('#parachute_wrap img')
          .animate({top:"1000px"},25000)
          .animate({top:"-100px", left: randomLeft()});
});
但它看起来不像我只是把一个函数作为一个值加入

您将如何进行此操作?

您是否尝试过以下方法:-

$('#parachute_wrap img').everyTime ( 11, function (){
          $('#parachute_wrap img')
          .animate({top:"1000px"},25000)
          .animate({top:"-100px", left: Math.floor(Math.random() * 101) + '%'});
});

$('#parachute_wrap img').everyTime ( 11, function (){
          $('#parachute_wrap img')
          .animate({top:"1000px"},25000)
          .animate({top:"-100px", left: Math.floor(Math.random() * 101) + 'px'});
});

用你的语法。你确定不是函数.everyTime()破坏了代码吗?可能是每次都破坏了代码。我为什么要尝试这个。。。这对我过于复杂的大脑来说太简单了:(天哪,它成功了。啊…谢谢!!!!