我有一个jQuery动画功能.动画结束后需要立即执行功能.所以必须使用回调函数.所以我试了一下.没有工作,我认为在那个特定的功能一定有问题所以我把它简化为这个......
phGrp.animate({bottom:0},
{duration: 1500, easing: 'swing'},
function(){alert('hello')}
);
Run Code Online (Sandbox Code Playgroud)
动画工作正常,没有错误,但回调不会执行.可能是什么问题?我看到了使用匿名函数的解决方案.所以我使用过它,但问题仍然存在.
请帮忙
尝试下面的东西,检查它正在工作的小提琴
phGrp.animate({bottom:0},1500,'swing',
function(){alert('hello');
}
);
Run Code Online (Sandbox Code Playgroud)
小提琴:http://jsfiddle.net/hYtuP/
请参阅链接:http://api.jquery.com/animate/
问题是回调函数需要在选项内部
.animate( properties, options )(参考,期权=持续时间,宽松,完成等)
phGrp.animate(
{
bottom:0
},
{
duration : 1500,
easing : 'swing',
complete : function(){ alert('hello') }
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5792 次 |
| 最近记录: |