<! DOCTYPE HTML > < HTML lang = "EN" > < head > < Meta charset = "UTF-. 8" > < title > the Document </ title > < style > body { height : 1000px ; } </ style > </ head > < body > < Script > // e.clientX e.clientY mouse position / in the visible region // //e.pageX / e.pageY mouse position on the page after IE9 compatibility problem is supported // pageY + = clientY page scrolling out from the document.onclick = function () { // // output page scrolling out distance // console.log (document.body.scrollLeft); // console.log (document.body.scrollTop); // // the documentElement document root element html tags // // console.log (document.documentElement) ; // // some browsers is to use these two properties to get the // console.log (document.documentElement.scrollLeft); // console.log (document.documentElement.scrollTop); } // get the page scrolling distance browser compatibility issues // get the page scrolling out of the distance function getScroll() { var scrollLeft = document.body.scrollLeft || document.documentElement.scrollLeft; var scrollTop = document.body.scrollTop || document.documentElement.scrollTop; return { scrollLeft: scrollLeft, scrollTop: scrollTop } } </script> </body> </html>