好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

jQuery Callback 方法

jQuery Callback 方法

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

jQuery 动画的问题

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

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

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

实例

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

使用 callback 实例

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


尝试一下

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

没有 callback(回调)

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


在线实例 »

查看更多关于jQuery Callback 方法的详细内容...

  阅读:23次

上一篇

下一篇

第1节:jQuery – AJAX get() 和 post() 方法    第2节:jQuery – AJAX load() 方法    第3节:jQuery Accordion    第4节:jQuery AJAX 方法    第5节:jQuery AJAX 简介    第6节:jQuery Autocomplete    第7节:jQuery css() 方法    第8节:jQuery Callback 方法    第9节:jQuery Cookie 插件    第10节:jQuery HTML / CSS 方法    第11节:jQuery noConflict() 方法    第12节:jQuery Growl 插件(消息提醒)    第13节:jQuery Password Validation(密码验证)    第14节:jQuery Prettydate    第15节:jQuery 遍历 – 祖先    第16节:jQuery 遍历    第17节:jQuery 尺寸    第18节:jQuery 获取并设置 CSS 类    第19节:jQuery 删除元素    第20节:jQuery 获取内容和属性    第21节:jQuery 教程    第22节:jQuery 安装    第23节:jQuery 简介    第24节:jQuery 链    第25节:jQuery 遍历 – 过滤    第26节:jQuery 遍历方法    第27节:jQuery Validate    第28节:jQuery 遍历 – 后代    第29节:jQuery 遍历 – 同胞(siblings)    第30节:jQuery Tooltip    第31节:jQuery 效果 – 停止动画    第32节:jQuery 添加元素    第33节:jQuery 设置内容和属性    第34节:jQuery 效果 – 动画    第35节:jQuery 效果 – 滑动    第36节:jQuery 效果 – 淡入淡出    第37节:jQuery 效果 – 隐藏和显示    第38节:jQuery 事件    第39节:jQuery 选择器    第40节:jQuery 语法    第41节:jQuery 属性    第42节:jQuery 效果方法    第43节:jQuery 事件方法    第44节:jQuery 实例    第45节:JSONP 教程    第46节:jQuery 杂项方法    第47节:jQuery 树型菜单插件(Treeview)