Skip to content Skip to sidebar Skip to footer

Jquery In Viewport Checker For Multiple Elements At Once

I have a jQuery function that checks if an element is in the viewport or not. If it is it adds the class 'animate' to start an animation and make the element visible. The above wor

Solution 1:

Yes. You can do it with $.each():

$(window).on("load resize scroll", function () {
    $('.blogcard').each(function() {
        if( $(this).isInViewport() ) {
            $(this).addClass('animate');
        }
    });
});

Post a Comment for "Jquery In Viewport Checker For Multiple Elements At Once"