<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