问题描述
限时送ChatGPT账号..我有一个 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/hYtuP/
参考链接:http://api.jquery/animate/
这篇关于Jquery Animate 的回调函数不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论