Js--scroll

Source: Internet
Author: User

ScrollWidth: Content Beyond the box, width is the width of the content, not beyond the box itself width+padding

ScrollHeight: Content beyond the box, height for the content of the high. No more than the box itself height+padding

Note: Ie67,scrollheight Even if the box is not exceeded, its value is also the height of the content

<!DOCTYPE HTML><HTMLLang= "en"><Head>    <MetaCharSet= "UTF-8">    <title>Title</title></Head><Body><Divstyle= "width:100px;height:100px;border:1px solid #000;">    <Divstyle= "width:120px;height:400px;border:1px solid #ccc;"></Div></Div><Script>    varDivele=document.getElementsByTagName ("Div")[0]; Console.log (divele.scrollwidth);//122Console.log (divele.scrollheight);//402</Script></Body></HTML>

ScrollLeft: The length of the left content to be rolled away by the browser

ScrollTop: The length of the head content that is curled by the browser

Note: Generally through window.onscroll monitoring, their use has serious compatibility issues, Google's judgment is based on the body, and IE is judged by the entire HTML

<Script>Window.onscroll=function () {        varXleft=Window.pagexoffset||Document.documentElement.scrollLeft||Document.body.scrollLeft; varytop=Window.pageyoffset||Document.documentElement.scrollTop||Document.body.scrollTop; Document.title=Xleft+"  "+ytop; }</Script>

Js--scroll

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.