vue-scroll-up

A Vue.js component to top of the page
5,651 10
Install
npm install vue-scroll-up@next
Latest Version:2.0.0
Vue:3
Older releases:2
License:MIT
Last Updated:Jan 8, 2023
Links: GitHub  ·  npm
Maintainer: runkids

vue-scroll-up

vue3 npm Version npm npm

Scroll up component for Vue 3.

Installation

Get from npm / yarn:

npm i vue-scroll-up@next
yarn add vue-scroll-up@next

๐Ÿ‘‰ Vue 2 version check here

Usage

Use inside your app:

import VueScrollUp from 'vue-scroll-up'

export default {
  components: {
    VueScrollUp,
  }
}

Or

import VueScrollUp from 'vue-scroll-up'

const app = createApp({});

app.component(VueScrollUp.name, VueScrollUp);
HTML
<vue-scroll-up 
  tag="div"
  custom-class="vue-scroll-up"
  :scroll-duration="1000"
  :scroll-y="250"
  :always-show="false"
/>
Use Slot
<vue-scroll-up
  v-slot="{ isTop }"
  :always-show="true"
>
  {{ isTop ? '๐Ÿ‘‡' : '๐Ÿ‘†' }}
</vue-scroll-up>

<vue-scroll-up
  v-slot="{ pointer }"
  :always-show="true"
>
  {{ pointer }}
</vue-scroll-up>
Design your scroll button ๐Ÿ‘‰ See example here
  1. Add your custom class name
<vue-scroll-up custom-class="my-scroll-up" />
  1. Add CSS
.my-scroll-up {
  align-items: center;
  background-color: rgba(0, 0, 0, 0.658);
  border: rgba(0, 0, 0, 0.658);
  border-radius: 100px;
  bottom: 100px;
  color: white;
  cursor: pointer;
  display: flex;
  height: 55px;
  justify-content: center;
  position: fixed;
  right: 10px;
  width: 55px;
  z-index: 99;
}

.my-scroll-up::after {
  border: 2px solid white;
  border-radius: 10px;
  content: '';
  display: block;
  height: 25px;
  margin: 0 auto;
  width: 10px;
}

.my-scroll-up::before {
  animation: 2s top infinite;
  border: 1px solid white;
  border-radius: 10px;
  content: '';
  display: block;
  height: 10px;
  left: 49%;
  position: absolute;
  width: 0;
}

@keyframes top {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media screen and (max-width: 450px) {
  .vue-scroll-up {
    bottom: 10px;
    transform: translateX(5px) scale(0.7);
  }
}

Attributes

Parameter Type Defaults Description
tag string span Default render element.
custom-class string vue-scroll-up Custom your class name.
scroll-duration number 200 Page to top speed.
scroll-y number 250 Show button when scrollY equals a number.
always-show boolean false Always show button even scroll to top.

Slot

Name Description
isTop Scroll button is top.
pointer Value of scroll y.

Related Packages

costumejs

Create web component style and variants

1,107
easyscroll

this is a tiny scroll bar plugin for vue2.0

871 41
vue-affix

A Vue.js plugin that affixes an element in the window while you scroll, similar...

153,389 405
vue-dragscroll

vue directive to make a scrollable element scroll by draging to the scroll direc...

1,541,547 264

Version History

Version Released Vue License
2.0.0 ^3.0.0 MIT
1.1.0 ^2.5.17 MIT
1.0.3 ^2.5.16 MIT
1.0.2 ^2.5.16 MIT
1.0.1 ^2.5.16 MIT