1// Animation of elements appearance 2;( function( $ ) { 3 "use strict"; 4 5 /** 6 * @class USAnimate (name) 7 * @param mixed container The container 8 * @return self 9 */ 10 var USAnimate = function( container ) { 11 var self = this; 12 13 // Elements 14 self.$container = $( container ); 15 self.$items = $( '[class*="us_animate_"]:not(.off_autostart)', self.$container ); 16 17 // Init waypoints 18 self.$items.each( function( _, item ) { 19 var $item = $( item ); 20 if ( $item.data( '_animate_inited' ) || $item.hasClass( 'off_autostart' ) ) { 21 return; 22 } 23 24 // Always add "start" class to elements inside Carousel. 25 // Because its elements should be animated on sliding carousel (not scrolling a page) 26 if ( $item.parents('.owl-carousel').length ) { 27 $item.addClass( 'start' ); 28 } 29 30 $item.data( '_animate_inited', true ); 31 const docHeight = document.documentElement.scrollHeight; 32 const offset = ( docHeight - $item.offset().top ) > docHeight * 0.12 ? '12%' : '0%'; 33 $us.waypoints.add( $item, offset, function( $node ) { 34 if ( ! $node.hasClass( 'start' ) ) { 35 $ush.timeout( function() { 36 $node.addClass( 'start' ); 37 }, 20 ); 38 } 39 } ); 40 // Event handler to initialize animation from outside 41 $item.one( 'us_startAnimate', function() { 42 if ( ! $item.hasClass( 'start' ) ) { 43 $item.addClass( 'start' ); 44 } 45 } ) 46 } ); 47 }; 48 49 // Export API 50 window.USAnimate = USAnimate; 51 52 // Init for loaded document 53 new USAnimate( document ); 54 55 // Start animation for WPB elements that use their own animation options 56 $( '.wpb_animate_when_almost_visible' ).each( function() { 57 $us.waypoints.add( $( this ), /* offset */'12%', function( $node ) { 58 if ( ! $node.hasClass( 'wpb_start_animation' ) ) { 59 $ush.timeout( function() { 60 $node.addClass( 'wpb_start_animation' ); 61 }, 20 ); 62 } 63 } ); 64 } ); 65} )( jQuery );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.