API Docs for: 1.0.0
Show:

Node~scrollIntoView Class

Only scrolls if the object is not currently visible.

This requires that all scrollable elements have position:relative. Otherwise, this algorithm will skip over them with unpredictable results.

Item Index

Methods

Methods

scrollIntoView

(
  • [config]
)
chainable

To receive notification of when the animation finishes, subscribe to the event scrollIntoViewFinished on the Y.Node instance. For consistency, this event always fires, even without animation.

If you modify the ancestor chain while the animation is running, the results will be unpredictable.

Parameters:

  • [config] Object optional

    configuration

    • [anim] optional

      true to use default duration and easing, or object

      • [duration] optional
        duration of animation
      • [easing] optional
        easing used during animation
    • [margin] optional

      viewport margins, to avoid ending up under an element with position:fixed

      • [top] optional
        top margin (px)
      • [bottom] optional
        bottom margin (px)
      • [left] optional
        left margin (px)
      • [right] optional
        right margin (px)