Customize The Scrolling Position On Route Navigation | vue-scroll-behavior

vue-scroll-behavior allows you to customize the position of the scroll on route navigation. Especially hash mode to tell it the ways to process it, and it will do it automatically.

Features

  • Simplicity – only need to call Vue.vueScrollBehavior(router)
  • Compatibility – Working in HTML5 history mode and hash mode
  • Automatically – Automatically saves or restores the scroll position
  • Customizable – Can manually save or restore the scroll position

Must Read: Try Scrolling on the Motion Blur Written in TypeScript Website

Customize The Scrolling Position On Route Navigation

Post NameVue JS Scroll Behavior
Author Namejeneser
CategoryMenu Plugins, Scrolling
Official PageClick Here | Click Here
Official Websitegithub.com
Publish DateApril 6, 2022
Last UpdateAugust 3, 2023
DownloadLink Below
LicenseMIT

How to make use of it:

Installation

npm install vue-scroll-behavior --save
import vueScrollBehavior from 'vue-scroll-behavior'

Vue.use(vueScrollBehavior, { router: router })

If you are using Vue globally, just include vue-scroll-behavior.js and it will install it automatically.

<script src="path/to/vue-scroll-behavior.js"></script>

<script>
  Vue.$vueScrollBehavior(router)
</script>

Options

List of available Options:

PropData TypeDefaultDescription
routerObjectThe router instance: const router = new VueRouter({})
elStringnullCSS selector: #app
ignoreArray[ ]RegExp list to ignore some routes, they will directly scroll to the top
maxLengthNumber50Saved history List max length
delayNumber0Delay scroll by a number of milliseconds

See Demo And Download

vue-js-scroll-behavior

Official Website(jeneser): Click Here

This superior jQuery/javascript plugin is developed by jeneser. For extra advanced usage, please go to the official website.

Related Posts

Google-Translate-Dropdown-Customize-With-Country-Flag

Google Translate Dropdown Customize With Country Flag | GT API

Flag google translates jQuery text that takes advantage of the Google Cloud Translation API to translate web content between languages by selecting a country from the dropdown…

Bootstrap-Fileinput

HTML 5 File Input Optimized for Bootstrap 4.x./3.x with File Preview | Bootstrap Fileinput

bootstrap-fileinput is an improved HTML 5 file input  Bootstrap 5.x, 4.x and 3.x with file preview for different files, provides multiple selections, resumable section uploads, and more….

HStack-and-VStack-in-CSS

CSS Layout Components Horizontal/Vertical Stack | HStack and VStack

HStack and VStack in CSS – CSS layout components that (basically) stack anything horizontally and vertically. A pure CSS library that makes it easy to stack elements…

Floating-Whatsapp-Chat-Button

How to Add Floating Whatsapp Chat Button In HTML | venom-button

Venom Button is a very simple plugin for the jQuery floating WhatsApp button. Adds a floating button to your site that calls WhatsApp Click to Chat API. It will automatically start the WhatsApp…

Data-Table-Generator-Tabulator

Interactive Data Table Generator with JS/jQuery and JSON | Tabulator

Tabulator allows you to create interactive tables in seconds from any HTML Table, JavaScript array, AJAX data source, or JSON format data. Just include the library in your…

alert-confirm-prompt-attention-js

Simple Alert, Confirm, Prompt Popup Using Vanilla JavaScript Library | attention.js

JavaScript provides various built-in functionality to display popup messages for different purposes. Attention JS is a vanillaJS plugin used to create a custom alert, confirm, or Prompt…

Leave a Reply

Your email address will not be published. Required fields are marked *