Summary of the progressive presentation of the asp.net page

Source: Internet
Author: User

For more information, see flush to split pages and present them gradually.
Suppose there is a page where the cnblogs logo icon is displayed at the beginning, and the csdn logo icon is displayed three seconds later.

Based on the above introduction, I have implemented the above functions using asp.net.
The ASP. NET code is as follows:
Copy codeThe Code is as follows:
<% @ Page Language = "C #" AutoEventWireup = "true" CodeBehind = "flush to gradually present Page blocks. aspx. cs "Inherits =" Web_1.flush to gradually display page blocks "%>
<! 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">
<Head runat = "server">
<Title> flush to gradually display page blocks </title>
</Head>
<Body>
<Div id = "head" style = "border: 1px solid # ccc;">
Cnblogs logo
</Div>
<%
// Flush multipart output
Response. BufferOutput = false;
Response. Flush ();
// Response. Output. Flush ();
%>
<Br/> load the following content in 3 seconds...
<Div id = "content" style = "border: 1px solid blue;">
<%
// Sleep for 3 seconds
System. Threading. Thread. Sleep (3000 );
%>
Csdn logo
</Div>
</Body>
</Html>


If you want to implement the effect of delayed loading of tudou.com homepage images, you can use jquery.
For details, refer to: technical analysis of the namesite-Introduction to the effect of tudou.com homepage image loading Delay

The JQuery code is as follows:
Copy codeThe Code is as follows:
<! 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">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Script type = "text/javascript" src = "http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"> </script>
</Head>
<Body>
Images that can be viewed at the beginning:

<Div id = "lazyBox" style = "margin-top: 100px;">
You cannot see the following picture at first, and you can see it after you scroll the mouse:

</Div>
<Div style = "height: 1000px;"> </div>
<Script type = "text/javascript">
Var hasShow = false;
$ (Window). bind ("scroll", function (){
If (hasShow = true ){
$ (Window). unbind ("scroll ");
Return;
}
Var t = $ (document). scrollTop ();
If (t> 50 ){
// The scroll height exceeds 50 and the image is loaded.
HasShow = true;
$ ("# LazyBox. lazyImg"). each (function (){
$ (This). attr ("src", $ (this). attr ("alt "));
});
}
});
</Script>
</Body>
</Html>

Related Article

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.