Skip to content

Simple ES6 Class for scroll window to DOM element with smooth animation

Notifications You must be signed in to change notification settings

Komock/scroll-window-to-element

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scroll-window-to-element

Simple ES6 Class for scroll window to DOM element with smooth animation

Example: komock.github.io/scroll-window-to-element/

Install

npm i --save-dev scroll-window-to-element

Usage

// Absolute path to module 'node_modules/scroll-window-to-element/lib/scroll-window-to-element.js'
import scrollToElement from 'scroll-window-to-element';
let scroller = new scrollToElement({
		anchors: 'nav a'
	});
scroller.init();

Options

Option Type Default Description
anchors string (html) 'a[href*="#"]' Selector for anchor (links)
duration number 350 Animation duration
offset number 0 Scroll offset
easing string 'easeInOut' Animation easing. Available: linear, easeInOut

To link section you can use 'id' or 'data-section' attribute (without '#').

Features

  1. Fast and lightweight
  2. No jQuery
  3. ES6 ready

About

Simple ES6 Class for scroll window to DOM element with smooth animation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published