Home  >  Article  >  Web Front-end  >  HTML: scrollLeft, scrollWidth, clientWidth, offsetWidth complete explanation_Experience exchange

HTML: scrollLeft, scrollWidth, clientWidth, offsetWidth complete explanation_Experience exchange

WBOY
WBOYOriginal
2016-05-16 12:07:381075browse

scrollHeight: Gets the scroll height of the object.

scrollLeft: Sets or gets the distance between the left edge of the object and the leftmost end of the currently visible content in the window

scrollTop: Sets or gets the distance between the topmost edge of the object and the leftmost end of the visible content in the window The distance between the tops

scrollWidth: Get the scroll width of the object

offsetHeight: Get the height of the object relative to the layout or the parent coordinate specified by the parent coordinate offsetParent property

offsetLeft :Gets the calculated left position of the object relative to the layout or the parent coordinates specified by the offsetParent property

offsetTop: Gets the calculated top position of the object relative to the layout or the parent coordinates specified by the offsetTop property

event.clientX is the horizontal coordinate relative to the document

event.clientY is the vertical coordinate relative to the document

event.offsetX is the horizontal coordinate relative to the container

event.offsetY is relative to the container Vertical coordinates

document.documentElement.scrollTop The value of vertical scrolling

event.clientX document.documentElement.scrollTop The amount of vertical scrolling relative to the horizontal coordinates of the document

Above Mainly refers to IE, the differences between FireFox are as follows:

IE6.0, FF1.06:

clientWidth = width padding

clientHeight = height padding

offsetWidth = width padding border

offsetHeight = height padding border

IE5.0/5.5:

clientWidth = width - border

clientHeight = height - border

offsetWidth = width

offsetHeight = height

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn