Scrolling Utils
Determine Scrolling Container
Might be worthwhile to read how this is done hereimport { scroll } from 'quasar'
const { getScrollTarget } = scroll
// Get parent DomNode that handles page scrolling
// Usually this is element with classname ".layout-view" or "window"
(DOM Element) getScrollTarget(DomElement)
Get/Set Scroll Position
import { scroll } from 'quasar' |
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
function scrollToElement (el) {
let target = getScrollTarget(el)
let offset = el.offsetTop - el.scrollHeight
let duration = 1000
setScrollPosition(target, offset, duration)
}
Determine Scroll Height
import { scroll } from 'quasar' |
Determining Scrollbar Width
Computes the width of scrollbar in pixels.import { scroll } from 'quasar'
const { getScrollbarWidth } = scroll
console.log(getScrollbarWidth()) // 16 (it's in pixels)