1. Returns the offset of the scrollbar as an object's X and Y properties
functionGetscrolloffsets (w) {//Use the specified window if the current window is used without parametersw= W | |window; //in addition to IE 8 and earlier versions, other browsers are available if(W.pagexoffset! =NULL) return{X:w.pagexoffset,y:w.pageyoffset}; //ie in the standard mode varD=w.document; if(document.compatmode== "Css1compat"){ return{x:d.documentelement.scrollleft,y:d.documentelement.scrolltop}; } //The browser in the weird mode return{x:d.body.scrollleft,y:d.body.scrolltop};}
2. The viewport dimensions of the query window
functionGetviewportsize (w) {//Use the specified window if the current window is used without parametersw= W | |window; //in addition to IE 8 and earlier versions, other browsers are available if(w.innerwidth!=NULL) return{w:w.innerwidth,h:w.innerheight}; //ie in the standard mode varD=w.document; if(document.compatmode== "Css1compat"){ return{w:d.documentelement.clientwidth,h:d.documentelement.clinetheight}; } //The browser in the weird mode return{w:d.body.clientwidth,h:d.body.clientwidth};}
Dom Operation three