// Get parent DomNode that handles page scrolling // Usually this is element with classname ".layout-view" or "window" (DOM Element) getScrollTarget(DomElement)
// Get scroll position of a element or page. Use it in conjunction with `getScrollTarget()` (Number pixels) getScrollPosition(scrollTargetDomElement)
// Setting scroll position of an element or page: setScrollPosition (scrollTargetElement, offset[, duration]) // if "duration" is specified then it will animate the scrolling
Scrolling to an element
A full example using the scroll utils to scroll to an element:
import { scroll } from'quasar' const { getScrollTarget, setScrollPosition } = scroll // takes an element object functionscrollToElement (el) { let target = getScrollTarget(el) let offset = el.offsetTop - el.scrollHeight let duration = 1000 setScrollPosition(target, offset, duration) }