Package Exports
- scrollto.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (scrollto.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
scrollto.js
Smooth scroll to a specific position or target element
Examples
import 'scrollto.js';
// Scroll the window object to a specific position
window.scrollToPosition(100, 100);
// Or scroll an element with overflow auto or scroll
let myFoo = document.getElementById('foo');
myFoo.scrollToPosition(300, 10, { duration: 300 });
// Scroll the window to the element with id bar
let myBar = document.getElementById('bar');
window.scrollToElement(myBar);
// Vertically scroll the window to element bar with an offset of 100px
window.scrollToElement(myBar, { horizontal: false, offsetY: 100 });
Scroll options
{
duration: 500,
horizontal: true,
vertical: true,
offsetX: 0,
offsetY: 0,
}
Installation
$ npm install scrollto.js --save