b-scroll-to [all b- libs]
Bornfight Studio frontend micro lib for smooth scrolling
Dependency: gsap
- install
b-scroll-to
trough npm or pull ti from git
npm i @bornfight/b-scroll-to
- include b-scroll-to to your JS after running npm install
import ScrollTo from "@bornfight/b-scroll-to";
new ScrollTo();
<a href="" data-scroll-to="#target" data-offset="100">
Scroll to target
</a>
data-scroll-to
can be id or class of target elementdata-offset
is type number with value in pixels
new ScrollTo({
ease: 'expo.out',
duration: 5
});
Option | Type | Default | Example | Description |
---|---|---|---|---|
ease | string | "power3.inOut" | "expo.out" | Scroll ease can be modified (gsap eases) |
duration | number | 1 | 10 | Duration of the scroll in seconds |
- Gulp 4 used
- browsersync for live reload
npm run dev - dev environent with browsersync
MIT © Bornfight Studio