Socket
Socket
Sign inDemoInstall

scroll-window-to-element

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    scroll-window-to-element

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


Version published
Weekly downloads
6
Maintainers
1
Install size
35.8 kB
Created
Weekly downloads
 

Readme

Source

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

OptionTypeDefaultDescription
anchorsstring (html)'a[href*="#"]'Selector for anchor (links)
durationnumber350Animation duration
offsetnumber0Scroll offset
easingstring'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

FAQs

Last updated on 20 Feb 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc