jQuery Callback 方法

jQuery 教程 · 2019-03-09 10:42:25

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

jQuery 动画的问题

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

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

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

实例

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

使用 callback 实例

$("button").click(function(){ $("p").hide("slow",function(){ alert("段落现在被隐藏了"); }); });

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

没有 callback(回调)

$("button").click(function(){ $("p").hide(1000); alert("段落现在被隐藏了"); });

点击查看所有 jQuery 教程 文章: https://codercto.com/courses/l/35.html

查看所有标签

Software Engineering for Internet Applications

Software Engineering for Internet Applications

Eve Andersson、Philip Greenspun、Andrew Grumet / The MIT Press / 2006-03-06 / USD 35.00

After completing this self-contained course on server-based Internet applications software, students who start with only the knowledge of how to write and debug a computer program will have learned ho......一起来看看 《Software Engineering for Internet Applications》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

URL 编码/解码
URL 编码/解码

URL 编码/解码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具