【IT专家】如何在jQuery中运行.animate函数?

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

本文由我司收集整编,推荐下载,如有疑问,请与我司联系
如何在jQuery中运行.animate函数?
如何在jQuery中运行.animate函数?[英]How do i run the .animate function in jQuery forever? This is what I tried, but using this approach i can’t get stuff moving. Im’ using jQuery 1.3.2. Any Suggestions?
 这是我尝试过的,但是用这种方法我不能让东西移动。

我使用jQuery 1.3.2。

有什么建议吗?
3
 You have the parameters to animate wrong. It doesn’t take an options hash, just the actual options for easing, duration, and a callback. Also, you need to take care when using this. Better to pass it in as an argument to the endless function.
 你有错误动画的参数。

它不接受选项哈希,只接受用于放松、持续时间和回调的实际选项。

另外,使用时要小心。

最好把它作为参数传递给无穷函数。

$(this).css(“left”,”100px”);function endless(elem){ $(elem).animate( { left:’-=100px’ }, “linear”, 5000, function() { $(elem).css(‘left’,’100px’); endless(elem);endless(this); 2
 You’ll need to call endless() from within a callback.
 您需要从回调中调用infinite()。

 function endless(item) { $(item).animate({“left”: “-=100px”}, 5000, “linear”, function(){ $(item).css(“left”,”100px”); endless(item);endless($(“.myBox”)); 0
 You need to replace $(this) with the selector to element that you want to animate.
 您需要将$(this)替换为要动画化的元素的选择器。

0
 Great! this is exactly what i searched for, but now,
 太棒了!这正是我所寻找的,但现在,
i finally figured how to toggle it. with the following function, call endless(0) to stop, and endless(1) to enable animation loop.
 我终于知道如何切换了。

使用下面的函数,调用infinite(0)来停止,调用。

相关文档
最新文档