asp.net page step-by-Step Presentation Method Summary _ Practical skills

Source: Internet
Author: User
For more information, please refer to: Flush let the page block, gradually rendered
Assume that there is a page, the first display Cnblogs logo icon, 3 seconds after the display of CSDN logo icon.

Based on the above, I have implemented the above functions with asp.net.
The ASP.net code is as follows:
Copy Code code as follows:

<%@ page language= "C #" autoeventwireup= "true" codebehind= "flush lets pages be progressively rendered. Aspx.cs" inherits= "Web_1.flush make the page block-by-step rendering "%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title>flush lets page blocks progressively render </title>
<body>
<div id= "Head" style= "border:1px solid #ccc;" >
Cnblogs logo
</div>
<%
Flush-Block output
Response.bufferoutput = false;
Response.Flush ();
Response.Output.Flush ();
%>
<br/> 3 seconds to load the following content ...
<div id= "Content" style= "border:1px solid blue;" >
<%
Sleep 3 seconds
System.Threading.Thread.Sleep (3000);
%>
CSDN logo
</div>
</body>


If you want to achieve the Tudou.com home page picture delay loading effect, you can use jquery easy to implement.
Detailed introduction, please refer to: Technical analysis of the name station-talking about tudou.com home page picture delay loading effect

The JQuery code is as follows:
Copy Code code as follows:

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<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>
<body>
The first picture to see:

<div id= "Lazybox" style= "margin-top:100px;" >
The following picture is not visible at first, and can be seen after scrolling 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) {
Scroll height over 50, load picture
Hasshow = true;
$ ("#lazyBox. lazyimg"). each (function () {
$ (this). attr ("src", $ (this). attr ("alt"));
});
}
});
</script>
</body>

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.