<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>12-静态方法holdReady方法</title>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script>
// $.holdReady(true):作用暂停ready()入口函数方法的执行
// 这里所谓的暂停就是要等到其他的图片,框架和插件加载完之后 可用
// $.holdReady(false); 恢复
$.holdReady(true);
$(document).ready(function(){
alert("ready");
})
</script>
</head>
<body>
<button>
回复ready事件
</button>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script>
$(function () {
var btn=document.getElementsByTagName('button')[0];
btn.onclick=function(){
console.log(btn);
alert("btn");
// 恢复
$.holdReady(false);
}
})
</script>
</body>
</html>
js中的holdReady()方法
最新推荐文章于 2021-02-24 16:48:40 发布