The difference between scrolltop and offsettop, the difference between Scrolltopleft and offsetleft

Source: Internet
Author: User

The difference between scrolltop and offsettop:
ScrollTop refers to the distance that a scrollable chunk scrolls down, such as scrolling down by 10 pixels, then the scrolltop attribute value of this element is 10, and the value of this property is read-write and does not need to be set position
Offsettop is the absolute distance between the top border of the element and the top border of the parent element.

ScrollLeft: Sets or gets the distance between the left and the leftmost of the object's contents, and the value of this property is readable and writable
Offsetleft: Gets the left position of the object relative to the layout or the parent coordinate specified by the Offsetparent property.

Calls to ScrollLeft and scrolltop must be on the parent element, otherwise invalid

Taget.style.top is applied to a specific element, not to the parent element, and the position value must be set to function.

The difference between scrolltop and offsettop, the difference between Scrolltopleft and offsetleft

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.