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

查看所有标签

The Art of Computer Programming, Volume 3

The Art of Computer Programming, Volume 3

Donald E. Knuth / Addison-Wesley Professional / 1998-05-04 / USD 74.99

Finally, after a wait of more than thirty-five years, the first part of Volume 4 is at last ready for publication. Check out the boxed set that brings together Volumes 1 - 4A in one elegant case, and ......一起来看看 《The Art of Computer Programming, Volume 3》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码