Div scroll bar

Source: Internet
Author: User

<SCRIPT>
$ (Document). Ready (function (){
VaR nscrollhight = 0; // The total length of the scroll distance (note that it is not the length of the scroll bar)
VaR nscrolltop = 0; // The current position to which the page is scrolled.
VaR ndivhight = $ (". Course-list-container"). Height ();
$ ('. Course-list-iner'). Scroll (function (){
VaR showcoursenum = $ (this). Children ('. Course-iner'). length;
VaR strtemp = pai.trim({('.course-{de'}.html ());
VaR totalcourse = parseint (strtemp. substring (0, strtemp. indexof ('tags ')));
Nscrollhight = $ (this) [0]. scrollheight;
Nscrolltop = $ (this) [0]. scrolltop;
/* If it is at the bottom of the browser */
If (nscrolltop + ndivhight> = nscrollhight ){
/* If the page displays more than 10 and no data is displayed */
If (showcoursenum >=10 & totalcourse> currentpage * 10 ){
$. Ajax ({
Type: 'post ',
URL: '/directory/searchlessons ',
Data: {page: currentpage + 1, type: dirtype, search: keyValue },
Datatype: 'html ',
Success: function (data ){
Currentpage ++;
/* Append data to the page */
VaR DATA = data. substring (data. indexof ('<Div class = "Course-iner') + 500 );
VaR course_info = data. substring (data. indexof ('<Div class = "Course-iner'), Data. lastindexof ('</div> '));
$ ('. Course-list-iner'). append (course_info );
}
});
} Else {
If ($ ('# Load-all-MSG'). Length <1 ){
$ ('. Course-list-iner'). After ("<Div id = 'Load-all-MSG '> loaded all </div> ");
$ ('# Load-all-MSG'). fadeout (4000 );
}
$ ('# Load-all-MSG'). Show ();
$ ('# Load-all-MSG'). fadeout (4000 );

}
}
});
});
// @ Sourceurl = Foo. js
</SCRIPT>

 

Additional reference: http://blog.csdn.net/zhangking/article/details/5722232

Div scroll bar

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.