JS Gets the height of the document: Math.max (document.body.scrollheight,document.documenelement.scrollheight);
JS Gets the height of the viewable area of the browser: Math.max (document.body.clientHeight, document.documentElement.clientHeight)//window.innerheight;
JS Get scroll bar height: document.documentElement.scrollTop | | Document.body.scrollTop;
jquery Gets the height of the document: $ (document). Height ();
jquery Gets the height of the viewable area of the browser: $ (window). Height ();
Scroll bar Scroll Height: $ (window). scrolltop ();
$ (document) when the page height is less than the browser window. Height () returns a $ (window). Height ().
Width and height!
Here is a more example of a rolling load:
1 varPage=1; 2 varFinished=0; 3 varsover=0;//is full screen4 varSubjectids =${subjectids}; 5 varLen =subjectids.length;6 //If the screen does not go to full screen auto-load Next page fills up7 varSetdefult=setinterval (function (){ 8 if(sover==1){ 9 clearinterval (Setdefult); Ten}Else if($ (". Dvd-box"). Height () < Window.innerheight | | len<4) { OneLoadmore ($ (window),true); A}Else - clearinterval (Setdefult); -},500); the - //load More - functionLoadmore (obj,flag) { - //flag, under full screen condition. + if(Finished==0 && sover==0){ - varScrollTop =$ (obj). scrolltop (); + varScrollHeight = $ (document). Height ();//Document Height A varWindowHeight = Window.innerheight;//Visible Area Height at - if($ (". Loadmore"). length==0) { - vartxt= ' <div class= "Loadmore" ><span class= "Loading" ></span> loading in: </div> ' -$ (". Dvd-box"). append (TXT); - } - if(Flag | | scrollheight-scrolltop-windowheight <=500 ) { in //here is the event triggered by the scroll bar to the bottom, where the data to be loaded is written, or the action that pulls the scroll bar - //prevent execution after not loading toFinished=1; + $.ajax ({ -Type: ' GET ', theURL: "alb/index/" +Subjectids[page], *Successfunction(data) { $ if(data== ""){ Panax NotoginsengSover = 1; - if(page = = 1) { the$ (". Loadover"). Remove (); + } A}Else{ theSetTimeout (function(){ + /*$ (". Loadmore"). Remove ();*/ -$ ('. Dvd-box. Loadmore '). before (data); $ lazyload (); $ imgerror (); -Page+=1; -Finished=0; the //last page - if(page==Len) { WuyiSover=1; the$ (". Loadmore"). Remove (); - } Wu},100); - } About }, $Errorfunction(XHR, type) { -Console.log (' Ajax error! '); - } - }); A + } the } - } $ //page scrolling Execution Events the$ (window). Scroll (function (){ theLoadmore ($ ( This)); the});
Each height and width in JavaScript is differentiated