jQuery.holdReady()方法
jQuery 教程
· 2019-03-26 23:12:18
实例
HTML元素单击右键触发事件
<button id="first">点击测试弹出</button>
<button id="second">解除延迟</button>
<script>
$.holdReady(true)
$(document).ready(function(){
$("#first").click(function(){
alert("解除延迟后被弹出");
})
})
$("#second").click(function(){
$.holdReady(false);
})
</script>
定义和用法
$.holdReady() 函数用于暂停或恢复.ready() 事件的执行。
注意:1. 该方法必须在文档靠前部分被调用,例如,在头部加载完 jQuery 脚本之后,立刻调用该方法。如果在 ready 事件已经被调用后再调用该方法,将不会起作用。
2. 首先调用$.holdReady(true)[调用后 ready 事件将被锁定]。当准备好执行 ready 事件时,调用$.holdReady(false)。
3. 可以对 ready 事件添加多个锁定,每个锁定对应一次$.holdReady(false)[解锁]调用。ready 事件将在所有的锁定都被解除,并且页面也已经准备好的情况下被触发。
语法
$.holdReady( hold )
| 参数 | 描述 |
|---|---|
| hold | Boolean类型 指示暂停或恢复被请求的ready事件 |
点击查看所有 jQuery 教程 文章: https://codercto.com/courses/l/35.html
Introduction to Programming in Java
Robert Sedgewick、Kevin Wayne / Addison-Wesley / 2007-7-27 / USD 89.00
By emphasizing the application of computer programming not only in success stories in the software industry but also in familiar scenarios in physical and biological science, engineering, and appli......一起来看看 《Introduction to Programming in Java》 这本书的介绍吧!
HTML 压缩/解压工具
在线压缩/解压 HTML 代码
HEX CMYK 转换工具
HEX CMYK 互转工具