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;
        }
    });
Was it helpful?

Solution

Use wow.js will reveal animation with scrolling.

http://mynameismatthieu.com/WOW/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top