JQuery Mobile adding load effects in page load Document.ready and window.onload execution order comparison _jquery

Source: Internet
Author: User
Tags xmlns

To add this effect, first figure out the loading of the page and the sequence of event execution, see this simple example:

 
 

Execution Result: 9 rows >14 rows >11 rows, 9 lines of code placed in different positions, the result remains the same. To understand the above order, if you want to let the page before loading display jquery Mobile loader, and then the page data request execution, pictures and other multimedia after loading, and then close the loader, you can follow the following ideas to solve:

 

Description

1) 9 lines of code to be slightly delayed execution, otherwise it is possible to refer to the JS file has not been loaded, this time call Showloader method, is not correctly executed, can not show the loader

2 shutdown loader can be placed in Document.ready or window.onload, specifically to see the implementation of the page needs.

3 If the speed is fast enough, two pictures in an instant load complete, it may not see the obvious loader display and shutdown process.

The above is a small set to introduce the jquery mobile in the page load add load effect Document.ready and window.onload execution order comparison, hope to help everyone, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.