|| 應用
How To Know I am at the very bottom side of document (用scroll 偵測到文件底部)
document.body.offsetHeight = window.innerHeight + window.scrollY
DOM Element
offsetHeight
The offsetHeight property returns the viewable height of an element in pixels, including padding, border and scrollbar, but not the margin.
Window Property
innerHeight
Returns the height of the window's content area (viewport) including scrollbarsinnerWidth
Returns the width of a window's content area (viewport) including scrollbarsouterHeight
Returns the height of the browser window, including toolbars/scrollbarsouterWidth
Returns the width of the browser window, including toolbars/scrollbarspageXOffset
Returns the pixels the current document has been scrolled (horizontally) from the upper left corner of the windowpageYOffset
Returns the pixels the current document has been scrolled (vertically) from the upper left corner of the windowscrollX
An alias of pageXOffsetscrollY
An alias of pageYOffset
Window Method
scrollTo
window.scrollTo(xpos, ypos)
滾動到特定位置, The scrollTo() method scrolls the document to the specified coordinates.scrollBy
滾動多少px, The scrollBy() method scrolls the document by the specified number of pixel