Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/anas-araid/vue-simple-scroll-up

simple and lightweight "back to top" Vue.js component which scrolls up smoothly when clicked.
https://github.com/anas-araid/vue-simple-scroll-up

library npm pull-to-refresh refresh reload scroll scroll-to-top scrolling scrolls vu-simple-scroll-up vue vue-component vue-simple-scroll

Last synced: about 1 month ago
JSON representation

simple and lightweight "back to top" Vue.js component which scrolls up smoothly when clicked.

Awesome Lists containing this project

README

        


Simple Scroll To Top


version
npm
npm bundle size
license


logo

Simple and lightweight 'back to top' Vue.js component which scrolls up smoothly when clicked.








Can be used also to refresh data to load newest contents using *scrolledOnTop* event.

> Inspired by Instagram, Linkedin, Reddit etc. scroll to refresh button. [[Images]](https://github.com/asdf1899/vue-simple-scroll-up#inspired-by-instagram-linkedin-reddit-etc-scroll-to-refresh-buttons)


## Demo



See [demo](https://anasaraid.me/vue-simple-scroll-up-example/).

# Getting Started

## Install via npm

```bash
npm i vue-simple-scroll-up --save
```

## Import

Import for global usage

```javascript
import Vue from 'vue'
import scrollUp from 'vue-simple-scroll-up'

Vue.use(scrollUp)
...
```

Or on a single component

```javascript
import scrollUp from 'vue-simple-scroll-up'
...
},
components: {
'vue-scroll-to-top': scrollUp
}
...
```
## Usage

Add this into your files:

```html

```

To trigger *scrolledOnTop* event:

```html

```

Overwrite this css properties to change button style:

```css
.vue-scroll-button{
background-color: #4CAF50; /* button background color */
color: white; /* button text color */
}
.vue-scroll-button:hover{
box-shadow: 0 12px 14px -6px #4CAF50; /* button shadow */
}
```

## Props

| Property | Type | Default Value | Description |
| ------------ | ------------ | ------------ | ------------ |
| text | String | 'Back to top' | Button description.|
| visibleY | Number | 400 | Show button when scrollY equals to visibleY value.|
| duration | Number | 800 | Scrolling animation duration.|

## Events

| Name | Description |
|------------------------|--------------------------------------------------------------------------|
| scrolledOnTop | Triggered when scrolling finished (can be used to refresh content) |

## Contributing

Finding bugs, sending pull requests or improving the docs - any contribution is welcome and highly appreciated.


### Inspired by Instagram, Linkedin, Reddit etc. scroll to refresh buttons



## License
[MIT](https://github.com/asdf1899/vue-simple-scroll-up/blob/master/LICENSE.md)