SoFunction
Updated on 2025-04-10

JS example method for judging various web page sizes


function reachBottom() {
     var scrollTop = 0;
     var clientHeight = 0;
     var scrollHeight = 0;
     if ( && ) {
         scrollTop = ;
     } else if () {
         scrollTop = ;
     }
     if ( && ) {
         clientHeight = ( < ) ? : ;
     } else {
         clientHeight = ( > ) ? : ;
     }
     scrollHeight = (, );
     if (scrollTop + clientHeight == scrollHeight) {
         return true;
     } else {
         return false;
     }
 }