( function( $ ) { /** Extending animate.css */ $( '[data-animation]' ).each( function( idx, elem) { $( this ).inViewport( function( visPx ) { $animateClassList = 'animate__animated'; if ( $( this ).data( 'animation' ) ) { $animateClassList += ' animate__' + $( this ).data( 'animation' ); } if ( $( this ).data( 'animation-delay' ) ) { $animateClassList += ' animate__delay-' + $( this ).data( 'animation-delay'); } if ( $( this ).data( 'animation-speed' ) ) { $animateClassList += ' animate__' + $( this ).data( 'animation-speed'); } if ( $( this ).data( 'animation-repeat' ) ) { $animateClassList += ' animate__repeat-' + $( this ).data( 'animation-repeat'); } if ( visPx ) { $( this ).addClass( $animateClassList ); } else { // Animate continuously by removing the animation off-screen and then applying it again. // $( this ).removeClass( $animateClassList ); } } ); } ); } ) ( jQuery );