Copy codeThe Code is as follows:
Function reachBottom (){
Var scrollTop = 0;
Var clientHeight = 0;
Var scrollHeight = 0;
If (document.doc umentElement & document.doc umentElement. scrollTop ){
ScrollTop = document.doc umentElement. scrollTop;
} Else if (document. body ){
ScrollTop = document. body. scrollTop;
}
If (document. body. clientHeight & document.doc umentElement. clientHeight ){
ClientHeight = (document. body. clientHeight <document.doc umentElement. clientHeight )? Document. body. clientHeight: document.doc umentElement. clientHeight;
} Else {
ClientHeight = (document. body. clientHeight> document.doc umentElement. clientHeight )? Document. body. clientHeight: document.doc umentElement. clientHeight;
}
ScrollHeight = Math. max (document. body. scrollHeight, document.doc umentElement. scrollHeight );
If (scrollTop + clientHeight = scrollHeight ){
Return true;
} Else {
Return false;
}
}