javascript - jQuery - 如何检测页面何时完成加载?

标签 javascript jquery html

如何检测页面是否完全加载完毕?我说完全是因为我尝试在 $(document).ready(function() 代码中放置一个警报语句,但是警报语句发生在 IE 中轮子停止旋转之前(大约 1.5 秒后,轮子停止,那是页面完全加载的时候。(它是你在 IE9 顶部看到的标签所在的加载轮)。

谢谢

最佳答案

你可以使用load方法:

The load event fires at the end of the document loading process. At this point, all of the objects in the document are in the DOM, and all the images and sub-frames have finished loading.

$(window).load(function(){
    // ...
})

关于javascript - jQuery - 如何检测页面何时完成加载?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12230867/

相关文章:

html - css中父容器上的幻影像素

JavaScript、正则表达式和空结果

javascript - 如何制作标题和第一列固定在垂直和水平滚动条上的表格?

javascript - 如何制作 Bootstrap 侧面板/div(不是菜单)

javascript - 单击后隐藏 DIV (jQuery)

javascript - 我应该使用 window.webkitRequestAnimationFrame 而不是 setInterval 吗?

javascript - 如何在 angular2 中对不同的 http 错误显示不同的错误消息?

javascript - iDangerous Swiper 未检测到滑动

javascript - 使用 JavaScript 从路径中获取文件名

javascript - 从 html 表单到 javascript