如果我使用$(document).ready()
即使文档就绪事件在过去已经发生过,它是否仍能保证仅在文档准备好时才运行其中的代码?
Yes.
来自 jQueryready
功能source.
// Catch cases where $(document).ready() is called after the
// browser event has already occurred.
if ( document.readyState === "complete" ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
return setTimeout( jQuery.ready, 1 );
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)