Back to Top
This is actually a directive and not a component. It allows to make visible any DOM elements (like buttons) which appear after a certain scroll offset. When clicked/tapped they take the user to the top of the page.
Installation
Edit /quasar.conf.js
:framework: {
directives: ['BackToTop']
}
Basic Usage
<!-- Bare bones example --> |
When using a Layout then you can take advantage of the Fixed Positioning on Layout component too and wrap your element with it, like this:<q-page-sticky position="top-right" :offset="[18, 18]">
<q-btn
v-back-to-top
round
color="primary"
@click="alert"
icon="keyboard_arrow_up"
/>
</q-page-sticky>
Vue Modifiers
Vue Modifier | Description |
---|---|
animate | Adds scrolling animation |
Vue Binding Value
You can use the binding value in 3 forms:
- No value. Defaults will apply.
- As a Number. This will be the scroll offset after which DOM element will be made visible.
- As an Object with
offset
and/orduration
as props. Duration is ignored ifanimate
modifier is not used.
Determining Scrolling Container
Please read here about how Quasar determines the container to attach scrolling events to.