All Projects → Developmint → vue-next-level-scroll

Developmint / vue-next-level-scroll

Licence: MIT license
Bring your scroll game to the next level!

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to vue-next-level-scroll

chrome-mouse-wheel-tab-scroller
Scroll Google Chrome tabs using mouse wheel
Stars: ✭ 39 (-20.41%)
Mutual labels:  scroll
use-scroll-direction
A simple, performant, and cross-browser hook for detecting scroll direction in your next react app.
Stars: ✭ 24 (-51.02%)
Mutual labels:  scroll
vue-dictaphone
🎙️ Vue.js dictaphone component to record audio from the user
Stars: ✭ 22 (-55.1%)
Mutual labels:  vue-component
EasyScrollDots
Single page scroll JavaScript plugin that allows for vertical navigation of page sections
Stars: ✭ 38 (-22.45%)
Mutual labels:  scroll
use-gesture
👇Bread n butter utility for component-tied mouse/touch gestures in React and Vanilla Javascript.
Stars: ✭ 6,624 (+13418.37%)
Mutual labels:  scroll
OverScroll
Use CoordinatorLayout+Behavior to achieve elastic scrolling and inertial scrolling for list. 利用CoordinatorLayout+Behavior实现弹性滚动和惯性滚动效果(类似微信首页).
Stars: ✭ 37 (-24.49%)
Mutual labels:  scroll
scrollpup.js
Minimal beautiful bar to show scroll progress. Pure Javascript Plugin.MIT
Stars: ✭ 83 (+69.39%)
Mutual labels:  scroll
vue-music
基于Laravel5.3+Vue2.0的网易云音乐的SPA应用
Stars: ✭ 85 (+73.47%)
Mutual labels:  vue-component
layui-vue
layui - vue(谐音:类 UI) 是 一 套 Vue 3.0 的 桌 面 端 组 件 库
Stars: ✭ 112 (+128.57%)
Mutual labels:  vue-component
magic-scroll
Apple Magic Mouse scrolling effect for normal mouses
Stars: ✭ 43 (-12.24%)
Mutual labels:  scroll
slider-manager
simple wrapper to create sliders focused on animations
Stars: ✭ 28 (-42.86%)
Mutual labels:  scroll
vue-telegram-login
Vue component for Telegram login
Stars: ✭ 73 (+48.98%)
Mutual labels:  vue-component
vue-tiny-pagination
A Vue component for create a tiny pagination with Flexbox
Stars: ✭ 20 (-59.18%)
Mutual labels:  vue-component
angular2-infinite-scroll
Infinite Scroll Directive For Angular (version 2 up to 2.3.1)
Stars: ✭ 16 (-67.35%)
Mutual labels:  scroll
vue-github-buttons
GitHub buttons component for Vue.
Stars: ✭ 36 (-26.53%)
Mutual labels:  vue-component
scrollbounce
Add a subtle bounce effect on mobile when the user scrolls (WIP)
Stars: ✭ 17 (-65.31%)
Mutual labels:  scroll
vue-github-activity
A Vue based github feed activity component.
Stars: ✭ 28 (-42.86%)
Mutual labels:  vue-component
vue-g2
基于 Vue 和 AntV/G2 的可视化组件库 📈
Stars: ✭ 73 (+48.98%)
Mutual labels:  vue-component
vue-magnify
vue-magnify / vue放大镜组件
Stars: ✭ 14 (-71.43%)
Mutual labels:  vue-component
react-bottom-scroll-listener
A simple listener component that invokes a callback when the webpage is scrolled to the bottom.
Stars: ✭ 129 (+163.27%)
Mutual labels:  scroll

VueNextLevelScroll - Bring your scroll game to the next level!

Build Status Code coverage Downloads Version License We use Conventional Commits Thanks badge

"Click to scroll" component using the modern Browser API.

🔥 Features

  • Just one tiny file
  • Component based (great for async loading and code splitting)
  • Supports navigation through VueRouter
  • Universal code/SSR-safe
  • Well tested and documented
  • Compatible with Node 8.0+
  • Vue as the only dependency
  • Highly customizable

🔎 Getting started

Demo

A live demo is available at https://oqxy5xr5ny.sse.codesandbox.io/.

📦 Through NPM

$ npm install vue-next-level-scroll

Synchronous import

import VueNextLevelScroll from 'vue-next-level-scroll'


export default {
  components: {
    VueNextLevelScroll
  }
}

Async import

export default {
  components: {
    VueNextLevelScroll: () => import('vue-next-level-scroll')
  }
}

🔗 Using a CDN

UNPKG | jsDelivr (available as window.nextLevelScroll)

Vue.component('scroll', window.nextLevelScroll)

// Continue as you wish. If you want to load a scroll behavior polyfill, do it **before** adding the CDN link.

🛠️ Usage

You might like to go for a Polyfill

VueNextLevelScroll uses the new ScrollBehavior specification by default. Unfortunately, Firefox is the only browser that has it built-in (by now). For this reason, you might like to go for this polyfill (don't worry, less than 2kB after GZIP).

The component based approach

As you likely have seen, there are various Vue directives out their that handle scrolling as well. You might have used one or two of them already or built one yourself.

But! A component can sometimes be the better approach, as it can be tree shaken, is better suited for universal/SSR code and can be loaded asynchronously as well!

Prop overview

Prop Optional? Comment
target Can be any query selector you want (or a function that returns such). Will be passed to the scroll function
tag Defaults to div. The HTML tag used for the VueNextLevelScroll component
scrollFunction You can define an own scroll function that will take the target prop as parameter and can do whatever you like.
shouldNavigate If set, VueRouter will reflect navigation changes in the url(top: no hash, target: hash)
navigationType Defaults to push. The navigation type of that VueRouter should use. Usually either push or replace

Default scroll function explained

Scroll to top

When no target prop is set, the default scroll function will trigger a scroll to top:

<vue-next-level-scroll>
  <img src="https://developmint.de/logo.png">
</vue-next-level-scroll>

Scroll to query selector

When the target prop is provided, the default scroll function look the DOM node up and smooth scroll to it. If the target is a class query, the first found element will be chosen to scroll to.

<vue-next-level-scroll target="#my-target">
  <img src="https://developmint.de/logo.png">
</vue-next-level-scroll>
<div id="my-target"/>

Scroll to non-existing query selector

When the target prop is given but no node matches, a console error will appear.

<vue-next-level-scroll target="#my-target">
  <img src="https://developmint.de/logo.png">
</vue-next-level-scroll>
<div id="my-non-existing-target"/>
Error: Could not scroll to #my-target

Custom scroll function

Most users are satisfied with the default scroll function provided by VueNextLevelScroll However if you need other behavior you can simply write your own function:

<template>
    <vue-next-level-scroll
      target="#my-target"
      :scrollFunction="myScroll">
      <img src="https://developmint.de/logo.png">
    </vue-next-level-scroll>
    <div id="my-non-existing-target"/>
</template>

<script>
export default {
 methods: {
   myScroll (target) { doSomeMagicHere(target) }
  }
}
</script>

You might not need the polyfill then as well 😉

⚙️ Contributing

Please see our CONTRIBUTING.md

📑 License

MIT License - Copyright (c) Developmint - Alexander Lichter

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].