The ready event occurs after the HTML document has been loaded, while the
onload event occurs later, when all content (e.g. images) also has been loaded.
The onload event is a standard event in the DOM, while the
ready event is specific to jQuery. The purpose of the ready event is that it should occur as early as possible after the document has loaded, so that code that adds funcionality to the elements in the page doesn't have to wait for all content
to load.
本文解析了网页加载过程中的两种关键事件:ready事件与load事件的区别。ready事件由jQuery触发,在HTML文档加载完成后即刻发生;而load事件是DOM标准事件,发生在页面所有内容(包括图片等资源文件)完全加载完毕之后。ready事件旨在尽快执行文档加载后的操作,避免等待额外资源加载导致的延迟。
1016

被折叠的 条评论
为什么被折叠?



