Giter Site home page Giter Site logo

anas-araid / vue-simple-scroll-up Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 116 KB

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

License: MIT License

JavaScript 37.41% Vue 62.59%
vue scroll scrolling refresh scroll-to-top npm library pull-to-refresh vue-simple-scroll vu-simple-scroll-up reload vue-component scrolls

vue-simple-scroll-up's Introduction

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]


Demo

See demo.

Getting Started

Install via npm

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

Import

Import for global usage

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

Vue.use(scrollUp)
...

Or on a single component

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

Usage

Add this into your files:

<vue-scroll-to-top text="Back to top" :visibleY="1200" :duration="1000"></vue-scroll-to-top>

To trigger scrolledOnTop event:

<vue-scroll-to-top text="Back to top" @scrolledOnTop="yourReloadFunction()"></vue-scroll-to-top>

Overwrite this css properties to change button style:

.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

vue-simple-scroll-up's People

Contributors

anas-araid avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.