When I scroll to top of "<selector>"

Scrolls to the top of a specific scrollable element.

Syntax

When I scroll to top of "<selector>"
When we scroll to top of "<selector>"
When scrolling to top of "<selector>"

Parameters

  • <selector> — A valid CSS selector identifying the element to scroll.

Example

When I scroll to top of "#off-canvas"

Notes

  • Throws an error if the selector is empty or invalid.
  • Throws an error if the element cannot be found in the DOM.