Jquery code that pulls a scroll bar to load data

Source: Internet
Author: User

Copy codeThe Code is as follows:
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head runat = "server">
<Title> pull the scroll bar to load data </title>
<Script src = "Scripts/jquery-1.4.1.min.js" type = "text/javascript"> </script>
<Script type = "text/javascript">
$ (Function (){
Var I = 4; $ (window). bind ("scroll", function (event)
{
// Scroll bar to the height of the webpage header, compatible with ie, ff, chrome
Var top = document.doc umentElement. scrollTop + document. body. scrollTop;
// Webpage height
Var textheight = $ (document). height ();
// Webpage height-top-current window height
If (textheight-top-$ (window). height () <= 100) {if (I >= 100) {return;
// The control can only be loaded to a maximum of 100
}
Dimensions ('{div1'}.css ("height", $ (document). height () + 100); I ++;
// Obtain Dynamic Data and load it to div1 based on actual conditions.
$ ('<Div>' + I + '</div>'). appendTo ($ ('# div1 '));
}
});
})
</Script>
<Style>
# Div1 div
{
Font-size: 100px;
Background: # ccc;
Margin-top: 5px;
}
</Style>
</Head>
<Body>
<Form id = "form1" runat = "server">
<Div style = "height: 1000px;" id = "div1">
<Div>
</Div>
<Div>
</Div>
<Div>
</Div>
<Div>
</Div>
</Div>
</Form>
</Body>
</Html>

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.