Use wow.js will reveal animation with scrolling.
animate when area is visible by scrolling Jquery
-
14-06-2023 - |
Question
I am using animate.css to give some animations for divs when scrolling. It is working, but the animation play when I start scrolling not when the animated area is visible. Any ideas how can i play the animation when area is visible ?! Following is my JavaScript code:
$(document).ready(function (){
$(window).scroll(function() {
var scroll = getCurrentScroll();
if ( scroll) {
$('.anim-left').addClass('animated bounceInLeft');
$('.anim-fade-right').addClass('animated flipInY');
}
});
function getCurrentScroll() {
return window.pageYOffset || document.documentElement.scrollTop;
}
});
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow