The timing of the Ready () function in jquery and the window's Load event are compared _jquery

Source: Internet
Author: User

The Ready () of jquery implements the Domcontentloaded event, the difference between domcontentloaded and the window Load event

Simply put, the ready () is triggered when the document is loaded, and the pictures and other resources may not be fully loaded, and load is triggered after all the resources have been loaded.

Look at the code for the ready function and it's all clear. The following code adds a comment:

Handle when the DOM was ready ready:function () {//Make sure this DOM is not already loaded I F (!jquery.isready) {//Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443
            ).
            if (!document.body) {return settimeout (Jquery.ready, 13);

            }//Remember That's DOM is ready Jquery.isready = true;
                If there are functions bound, to execute if (readylist) {//execute all of them
                var fn, i = 0;
                while (fn = readylist[i++])) {Fn.call (document, JQuery);
            }//Reset the list of functions readylist = null; }//Trigger any bound Ready events if (JQuery.fn.triggerHandler) {JQuery (doc
            ument). Triggerhandler ("Ready");
 }
        }
    },

The above is the entire contents of this article, I hope you can enjoy.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.