1.0.0 • Published 2 years ago

vue-top-scroll v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

vue-top-scroll

Simple customizable Vue component to add anywhere for a responsive "back to top" button.

Alt Text

Installation

npm i vue-top-scroll

Basic Usage

  • Register the component in your main app.js or equivalent file, eg:
import TopScroll from 'vue-top-scroll';

Vue.component('top-scroll', TopScroll);
  • Once registered you can just add it to any component
<top-scroll></top-scroll>
  • By default it uses font awesome 5 far fa-angle-up icon but you can pass an icon prop with anything else

Available props

You can either use the component as it is or pass some extra arguments in case you want to customize it. None of the props is required

NameDefaultTypeDescription
color#e91e63StringThe button background color
iconfar fa-angle-upStringThe button icon
size60pxStringSize of the button
font32pxStringIcon font-size
fontcolor#fffStringIcon color
visibleoffset600String, NumberOffset (pageYOffset) from top of when the icon should show up
right50pxStringPosition from the right edge
bottom80pxStringPosition from the bottom
  • Customized example
<top-scroll color="#0091ea"
            icon="glyphicon glyphicon-chevron-up"
            size="50px"
            font="25px"
            fontcolor="#000"
            visibleoffset="900"
            right="10px"
            bottom="30px">
</top-scroll>

Alt Text