A Vue.js component scrolls to the top of the page
vue-scroll-up
A Vue.js component scrolls to the top of the page.
Installation
Get from npm / yarn:
npm i vue-scroll-up
yarn add vue-scroll-up
or
just include vue-scroll-up.js to your view like
<script src='./vue-scroll-up.js'></script>
Usage
Use this inside your app:
import ScrollUp from 'vue-scroll-up'
export default {
name: 'app',
components: {
ScrollUp,
}
}
With Default CSS
import 'vue-scroll-up/dist/style.css'
or
just include style.css
The scroll button class name is vue-scroll-up
HTML
<scroll-up :scroll-duration="1000" :scroll-y="250"></scroll-up>
Props
Property | Type | Default Value | Description |
---|---|---|---|
scroll-duration | Number | 1000 | Page to top speed. |
scroll-y | Number | 250 | Show button when scrollY equals a number. |