开发者

When it is said "the DOM is ready" is the same as saying "the page is loaded"?

when it is said "the DOM is ready" is the same as saying "the page is loaded" ?

Regards

开发者_开发技巧Javi


No. The DOM is ready before the images (for example) have been loaded.


Check out this post:

  • $(document).ready vs. $(window).load

document ready

The document ready event executes already when the HTML-Document is loaded and the DOM is ready, even if all the graphics haven’t loaded yet. If you want to hook up your events for certain elements before the window loads, then $(document).ready is the right place.

window load

The window load event executes a bit later when the complete page is fully loaded, including all frames, objects and images. Therefore functions which concern images or other page contents should be placed in the load event for the window or the content tag itself.


It depends on what you mean by "ready". The "DOM ready" event only means that the document structure has been fully created and is ready to be manipulated.

See the JQuery's .ready() API for more informations.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜