Hierarchy

  • ScrollingData

Index

Constructors

constructor

  • elem: The element that should be scrolled scrollDirection: "scrollLeft" if the element should be scrolled on the horizontal axis, "scrollTop" otherwise

    Parameters

    Returns ScrollingData

Properties

duration

duration: number = 0

Private elem

elem: Node

endPos

endPos: number

Private scrollDirection

scrollDirection: scrollingDirection

scrolling

scrolling: boolean = false

startPos

startPos: number

startTime

startTime: number

Methods

Private getStep

  • getStep(): number
  • Computes where the element should be. This changes depending on how long ago the first scrolling attempt was made. It might be useful to make this function more configurable by making it accept an argument instead of using performance.now()

    Returns number

Private scheduleStep

  • scheduleStep(): void
  • Calls this.scrollStep() until the element has been completely scrolled or the scrolling animation is complete

    Returns void

scroll

  • scroll(distance: number, duration: number): boolean

Private scrollStep

  • scrollStep(): boolean
  • Updates the position of this.elem, returns true if the element has been scrolled, false otherwise.

    Returns boolean