-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
23 lines (18 loc) · 837 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import {elementAnimate, keyscroller} from "keyscroll";
import {nativeSmoothScroll} from '@smoovy/scroller';
import './index.scss';
window.onload = () => {
const scroller = nativeSmoothScroll({ element: document.querySelector('.sections')});
keyscroller.initializeFromCallbackFn(scroller.onScroll.bind(scroller));
const elements = document.querySelectorAll('[data-keyscroll]');
for (const element of elements) {
const keyframe = element.getAttribute('data-keyscroll');
const animationStart = +(element.getAttribute('data-keyscroll-start') || 0);
const animationEnd = +(element.getAttribute('data-keyscroll-end') || 1);
elementAnimate.attachAnimation(element, keyframe, {
animationTiming: 'linear',
animationStart,
animationEnd,
});
}
}