Jquery Animate 的回调函数不起作用 [英] Jquery Animate's callback function not working

查看:40
本文介绍了Jquery Animate 的回调函数不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 jQuery 动画功能.需要在动画结束后立即执行功能.所以必须使用回调函数.所以我试了一下.没有用,我认为那个特定的功能一定有问题,所以我把它简化为这个......

I have a jQuery animate function. A need to execute a function as soon as animation ends. So gotta use callback function. So I tried it. Didn't work, I thought there must be problem in that particular function so I reduced it to simply this...

phGrp.animate({bottom:0},
              {duration: 1500, easing: 'swing'}, 
              function(){alert('hello')}
);

动画正常工作,没有错误,但回调不会执行.可能是什么问题?我看到了使用匿名函数的解决方案.所以我已经使用了它,但问题仍然存在.

Animation works correctly, no error, but callback won't execute. What can be the problem? I saw a solution of using anonymous function. So I have used it, but still problem persists.

请帮忙

推荐答案

尝试类似下面的操作,检查它是否正常工作

try something like below, check the fiddle it is working

 phGrp.animate({bottom:0},1500,'swing', 
          function(){alert('hello');
         }
 );

小提琴:http://jsfiddle.net/hYtuP/

参考链接:http://api.jquery.com/animate/

这篇关于Jquery Animate 的回调函数不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆