滾動捲軸的應用

|| 應用

How To Know I am at the very bottom side of document (用scroll 偵測到文件底部)
document.body.offsetHeight = window.innerHeight + window.scrollY

DOM Element

  1. offsetHeight

    The offsetHeight property returns the viewable height of an element in pixels, including padding, border and scrollbar, but not the margin.

Window Property

  1. innerHeight

    Returns the height of the window's content area (viewport) including scrollbars
  2. innerWidth

    Returns the width of a window's content area (viewport) including scrollbars
  3. outerHeight

    Returns the height of the browser window, including toolbars/scrollbars
  4. outerWidth

    Returns the width of the browser window, including toolbars/scrollbars
  5. pageXOffset

    Returns the pixels the current document has been scrolled (horizontally) from the upper left corner of the window
  6. pageYOffset

    Returns the pixels the current document has been scrolled (vertically) from the upper left corner of the window
  7. scrollX

    An alias of pageXOffset
  8. scrollY

    An alias of pageYOffset

Window Method

  1. scrollTo

    window.scrollTo(xpos, ypos)
    滾動到特定位置, The scrollTo() method scrolls the document to the specified coordinates.
  2. scrollBy

    滾動多少px, The scrollBy() method scrolls the document by the specified number of pixel