之间有什么区别
$(window).load(function () {});
和
$(window).ready(function () {});
窗口加载和窗口就绪之间有什么区别?
答案 0 :(得分:0)
答案 1 :(得分:0)
document.ready
是一个jQuery事件,它在DOM准备就绪时运行
window.onload
稍后会在加载图片等时触发
示例脚本
$(document).ready(function() {
// executes when HTML-Document is loaded and DOM is ready
alert("document is ready");
});
$(window).load(function() {
// executes when complete page is fully loaded, including all frames, objects and images
alert("window is loaded");
});
参见