2016

25
Our Blog post image goes here

Callback 函数在当前动画 100% 完成之后执行。


jQuery 动画的问题

许多 jQuery 函数涉及动画。这些函数也许会将 speedduration 作为可选参数。

例子:$("p").hide("slow")

speedduration 参数可以设置许多不同的值,比如 "slow", "fast", "normal" 或毫秒。

实例

以下实例在隐藏效果完全实现后回调函数:

使用 callback 实例

$("button").click(function(){ $("p").hide("slow",function(){ alert("The paragraph is now hidden"); }); });

尝试一下

以下实例没有回调函数,警告框会在隐藏效果完成前弹出:

没有 callback(回调)

$("button").click(function(){ $("p").hide(1000); alert("The paragraph is now hidden"); });

在线实例 »

上一篇:jQuery 效果 – 停止动画

下一篇:jQuery Chaining

文章

总共 0 条评论

填写评论