Method 1
Page loading entries are generally used by everyone. Its principle is very simple: place a text or image loading state in the page header, and load a piece of JS at the end of the page to hide it, that is, the simple loading state bar implemented based on the loading sequence of the browser.
Demonstrate the loading sequence of traditional WordPress templates in the browser. The appearance and disappearance of loading entries are distributed at the beginning and end.
If we place multiple JavaScript codes in different locations on the page, and each JS is used to gradually increase the width of the loading entry, this loading entry will undoubtedly be more practical. To some extent, it relieves the boring feeling of visitors waiting for loading, and objectively reflects the page loading progress. If you use jquery's built-in animation effects, they are perfectly comparable to those of the browser's built-in status bar.
Let's take a look at the demo:Address.
To obtain the progress bar on the demo,First, Introduce the jquery framework (must be placed in the page header
Label ). Then place the tag at the starting position of the <body> tag:
<Div id = "loading"> <div> </div>
CSS can be written as follows:
# Loading {
Width: 100px;
Height: 20px;
Background: # a0db0e;
Padding: 5px;
Position: fixed;
Left: 0;
Top: 0;
}
# Loading Div {
Width: 1px;
Height: 20px;
Background: # f1ff4d;
}
The preparations are now ready.
Next, Please try it out at will. Based on your understanding of Figure 2, place the following in the appropriate positions of each part of the template:
<SCRIPT type = "text/JavaScript">
$ ("# Loading Div"). animate ({width: "16px "})
</SCRIPT>
The red value should gradually increase with the loading order until footer. php. In addition, do not forget to put it at the end of footer. php:
<SCRIPT type = "text/JavaScript">
$ ("# Loading"). fadeout ()
</SCRIPT>
Used to hide the progress bar after loading.
Second
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <HTML xmlns = "http://www.w3.org/1999/xhtml">
Third-oriented
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <HTML xmlns = "http://www.w3.org/1999/xhtml">
Type 4 IFRAME Loading
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Explanation: 0: (uninitialized) The send () method has not yet been invoked.
1: (loading) The send () method has been invoked, request in progress.
2: (loaded) The send () method has completed, entire response received ed.
3: (interactive) The response is being parsed.
4: (completed) the response has been parsed, is ready for harvesting.
0-(not initialized) The send () method has not been called
1-(load) The send () method has been called and a request is being sent.
2-(Loading completed) The send () method is executed completely and all response content has been received
3-(interaction) parse the response content
4-(complete) The response content has been parsed and can be called on the client
5. Attach Images
<HTML>
Or use
<script src="jquery-1.3.2.min.js" type="text/javascript"></script><script src="MinmyLazyload.js" type="text/javascript"></script><body><script type="text/javascript">$("img").lazyload({ placeholder: "img-loader.gif", effect:"fadeIn" });</script></body>
Find minimylazyload. js in the attachment
Sixth page
<Style> # loading {font-size: 12px; color: # ffffff; Background: # ff0000; position: absolute; top: 500px; left: 500px; Z-index: 1002; padding: 2px 10px 2px 10px }</style> <body> <Div id = "loading"> loading pages... </Div> .......... <SCRIPT type = "text/JavaScript"> document. write ('<style ># loading {display: None ;}</style>'); </SCRIPT> </body>