1.0.2 • Published 5 years ago

animate-scroll-to-hash v1.0.2

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

animate-scroll-to-hash

Installing

Using npm:

$ npm install animate-scroll-to-hash

How to use

const AnimateScrollToHash = require('animate-scroll-to-hash');
new AnimateScrollToHash(); // set listeners to all links with hash on page

Config

You can pass the configuration object to the constructor. If you want set listeners on links only to children of block:

new AnimateScrollToHash({
  block: document, // search for links. default: document
});

If you have fixed header element, you may set margin:

new AnimateScrollToHash({
  margin: 60, // top margin after scrolling (px). default: 0
});

If height of header may vary depending on screen width:

new AnimateScrollToHash({
  margin: {
    0: 60, // if client width more than or equal to 0.
    960: 80, // if client width more than or equal to 960.
  },
});

You can change animation duration

new AnimateScrollToHash({
  transition: 500, // animation duration (ms). default: 500
});
1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago