Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //---------------- COUNTER LOGIC----------------------
- function runAnimtion() {
- anime({
- targets: '.counter-1',
- textContent: [0, 42],
- round: 1,
- easing: 'linear',
- duration: 1000
- });
- }
- const observer = new IntersectionObserver(
- entries => {
- entries.forEach(entry => {
- if (entry.intersectionRatio >= 0.7) {
- runAnimtion();
- observer.disconnect();
- }
- });
- }, {
- threshold: 0.7
- }
- );
- observer.observe(document.querySelector('.target-section'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement