Skip to content

Latest commit

 

History

History
20 lines (15 loc) · 729 Bytes

animateTo.md

File metadata and controls

20 lines (15 loc) · 729 Bytes

AnimateTo

Creates a method to scroll with animation to a certain element or value.

import animateTo from "@runroom/purejs/lib/animateTo";

// Usage
animateTo({ element: 300 });
// or
animateTo({ element: "#section", speed: 500 });

It will anchor to a certain value or element in the window. If a class or id is passed, it will search it on the window and will get its offset top.

Setting Description
element {integer|string} Number, element class or id
speed {integer} Speed of the animation. Default is 500
offset {integer} Offset of the scroll. Default is 0