Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ScrollManager

Scroll Manager

Manages whole scroll operations

Hierarchy

  • ScrollManager

Index

Constructors

Accessors

Methods

Constructors

constructor

  • new ScrollManager(observerThrottleTime?: number): ScrollManager
  • Scroll Manager Constructor

    Parameters

    • Optional observerThrottleTime: number

      Throttling time for scroll-observers

    Returns ScrollManager

Accessors

root

  • Window Scroll Observer


    Example:

    manager.root.scroll.subscribe(position => console.log(position));
    manager.root.scrollDirectionChange.subscribe(direction => console.log(direction));

    Returns ScrollObserver

Methods

observe

  • Observe a scrollable target


    Example:

    const element = document.getElementById("#content");
    const contentScrollObserver = manager.observe(element);
    
    contentScrollObserver.scroll.subscribe(position => console.log(position));
    
    contentScrollObserver.scrollDirectionChange.subscribe(direction => console.log(direction));

    Parameters

    • target: ScrollableContent

      Scroll target

    • Default value throttleTime: number = this.observerThrottleTime

      Time to throttle the scroll events

    Returns ScrollObserver

scrollToElement

  • scrollToElement(element: HTMLElement, __namedParameters?: object): Promise<ScrollPosition>
  • Scroll to Element

    Scroll the window into an element


    Example:

    manager.scrollToElement(document.getElementById("#next-content"))

    Parameters

    • element: HTMLElement

      Element to scroll into

    • Default value __namedParameters: object = {animate: true, offsetTop: 0, offsetLeft: 0}

    Returns Promise<ScrollPosition>

    A promise which will be resolved right after the scrolling completed

scrollTop

Generated using TypeDoc