We often do some things after the page is loaded, such as the display and hiding of some elements, some animation effects. We usually have two ways to do this, one is the Window.onload event and the other is the ready () method of jquery. So what is the difference between these two methods? Look down:The onload event is triggered after all the elements in the page and when the content is fully loaded, while the Re
We continue to say JS, we often do some things after the page loading, such as the display of some elements and hidden, some animation effect. We usually have two ways to do this, one is the Window.onload event and the other is the ready () method of jquery. So what is the difference between these two methods? Look down:The onload event is triggered after all the elements in the page and when the content is fully loaded; The
Task Readiness TableThe ready state flags for each task are placed in the ready table, with two variables osrdygrp and osrdytbl[] in the Ready table.In Osrdygrp, tasks are grouped by priority, with 8 tasks as a group. Each of the OSRDYGRP indicates whether there are tasks in each group in the 8-group task that have entered the
JQuery execution mechanism(Differences between onload and ready)
Self-Test Before conclusion: To test whether 20000 photos are inserted on the page, the number of photos is small, so I switched to the console. log () to test, so that I can see whether all of them are loaded at the bottom of the page, and the event sequence of the printed results.
VcD4KPHA + y/nTw7W9tcRKU7T6wuvKx6O6PC9wPgo8cD48cHJlIGNsYXNzPQ = "brush: java;"> console. time ('na
The Ready method in jquery implements the effect of when the page is loaded, but he is not a window.onload or doucment.onload package, but rather a standard Web browser DOM hides APIs and IE browser flaws, first of all, Let's see the code for jquery.
Copy Code code as follows:
domcontentloaded = function ()
{
Cancel event sniffing, execute Ready method if (Document.addeventlistener)
{
$ (Document). ready () in Jquery is similar to the window. onload method in traditional JavaScript, but it is different from the window. onload method.
1. execution time
Window. onload can only be executed after all elements including images in the page are loaded.
$ (Document). ready () is executed after the DOM structure is drawn. You do not have to wait until the loading is complete.
2. different num
DescriptionAfter the page loads the document, the browser adds events to the DOM element via Javascript. Javascript uses the Window.onload method, while JQuery uses the $ (document). Ready () method. $ (document). The Ready () method can greatly improve the speed of a WEB application because the method can manipulate the DOM as it is loaded and invoke the method that executes it to bind to it. The $ (docume
This article mainly introduces jquery $ (document ). ready () and window. onload differences, This article summarizes the execution time, the number of different writes, simplified writing and other different places, need friends can refer to Jquery $ (document ). ready () is similar to Windows in traditional JavaScript. onload method, but with window. the onload method is different.
1. execution timeWindo
jquery $ (document). Ready () is similar to the Window.onload method in traditional JavaScript, but differs from the window.onload approach.
1. Execution TimeWindow.onload must wait until all the elements of the page that include the picture have been loaded before they can be executed.$ (document). Ready () is executed when the DOM structure is drawn and does not have to wait for the load to complete.2. D
This article mainly introduces the differences between JQuery's ready function and JS's onload function. If you need it, you can refer to the differences between JQuery's ready function and JS's onload function:
1. execution time
Window. onload can only be executed after all elements including images in the page are loaded.
$ (Document). ready () is executed afte
Example of ready event usage in jQuery, jqueryready
This example describes the ready event usage in jQuery. Share it with you for your reference. The specific analysis is as follows:
This event will be triggered after the document is loaded, that is, when the DOM object has been loaded and all webpage content is displayed.The ready () method can bind an event pro
jquery $ (document). Ready () is similar to the Window.onload method in traditional JavaScript, but differs from the window.onload approach.1. Execution timeWindow.onload must wait until all the elements of the page that include the picture have been loaded before they can be executed.$ (document). Ready () is executed when the DOM structure is drawn and does not have to wait for the load to complete.2. Dif
Today, I have nothing to do with jquery. the internal implementation of ready () is confused by the source code of JQ. Because of the fact that I am very fond of cooking, I flipped through the podcast of the cool-man, telling details and gaining a lot.
First, popularize jquery. ready () and window. onload, window. the onload event is triggered after all resources on the page are loaded. if there are large i
Generally, the onload of the Body Tag is set to listen to the load event of the window. however, the load event is triggered only after all the elements on the page are loaded. If there are too many pages or the picture is too large, it will lead to initialization.
Code When not executed, the user performs other operations. the jquery Library provides a very convenient and useful function ($ (selector ). ready (), so that we can perform corresponding
This function mentioned three equivalent forms in jQuery's document:Copy codeThe Code is as follows:// Defined in jQuery. fn. ready$ (Document). ready (handler );// It is the same as the previous one and is not recommended.$ (). Ready (handler );// Process in the jQuery object separately$ (Handler );// The preceding definition:If (jQuery. isFunction (selector ){R
Page loading completed there are two kinds of events, one is ready, indicating that the document structure has been loaded complete, Onload,ready concept is easy to confuse, the following for everyone in detailPage loading completed there are two kinds of events, one is ready, indicating that the document structure has been loaded complete (not including pictures
This article mainly gives you detailed information on Jquery's implementation of ready and bind events. If you are interested, you can refer to this section before reviewing the previous Code:
(Function (win) {var _ $ = function (selector, context) {return new _ $. prototype. init (selector, context);} _ $. prototype = {Init: function (selector, context) {this. elements = []; var context = context | document; if (context. querySelectorAll) {var arr
Window.onload must wait until all the elements of the page that include the picture have been loaded before they can be executed. ------> Cannot write multiple (if there are multiple, only one will be executed)$ (document). Ready () is executed when the DOM structure is drawn and does not have to wait for the load to complete. -------> can write multiple----> with $ (function () {});$ (document). Ready (fun
Therefore, the ready of jquery can improve the response speed of the Web page;
Jquery:ready's standard wording:
Copy Code code as follows:
$ (document). Ready (function () {
Alert ("Load End");
});
A $ (document) converts the document of a DOM object into a jquery object, which can then invoke the JQuery method ready (), because the DO
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.