1"use strict" 2 3function yprmItemsAnimation($container) { 4 let type = $container.attr('data-items-animation'), 5 delay = +$container.attr('data-items-animation-delay'), 6 target = $container.attr('data-items-animation-target'), 7 $items = $container.find(target), 8 tempTop = 0, 9 tempDelay = 0, 10 windowHeight = jQuery(window).height() * 1, 11 precentFn = (max, precent) => { 12 return max * precent / 100 13 }, 14 scrollFn = (scrollTop) => { 15 $items.each(function (index) { 16 let offsetTop = jQuery(this).parent().offset().top + windowHeight*.2 17 18 if(typeof window.SmoothScroll !== 'undefined') { 19 offsetTop = scrollTop + jQuery(this).parent().offset().top - windowHeight*.8 20 } 21 22 if (scrollTop > offsetTop) { 23 let delay = jQuery(this).attr('data-animation-delay') 24 25 jQuery(this).delay(delay).queue(function () { 26 jQuery(this).addClass('animated') 27 }) 28 } 29 }); 30 }, 31 parallaxFn = (scrollTop) => { 32 33 $items.each(function () { 34 let offsetTop = jQuery(this).parent().offset().top - windowHeight*.2, 35 percent = (scrollTop - offsetTop) * 100 / windowHeight, 36 scale = 1, 37 transformOrigin = '50% 50%' 38 39 if(typeof window.SmoothScroll !== 'undefined') { 40 offsetTop = scrollTop + jQuery(this).parent().offset().top - windowHeight*.8 41 } 42 43 if (percent <= 0 || percent >= 100) return 44 45 if (percent <= 0) { 46 percent = 0 47 } else if (percent >= 100) { 48 percent = 100 49 } 50 51 if (type == 'parallax') { 52 transformOrigin = '50% ' + percent + '%' 53 scale = 1.3 54 } 55 56 if (type == 'zoomIn') { 57 scale += precentFn(.3, percent) 58 } 59 60 if (type == 'zoomOut') { 61 scale += precentFn(.3, 100 - percent) 62 } 63 64 gsap.to(jQuery(this).find('.img div, .img img'), .3, { 65 transformOrigin: transformOrigin, 66 scale: scale, 67 ease: Power2.easeOut 68 }) 69 }) 70 }, 71 animationFn = (scrollTop) => { 72 if ( 73 'parallax' == type || 74 'zoomIn' == type || 75 'zoomOut' == type 76 ) { 77 parallaxFn(scrollTop) 78 } else { 79 scrollFn(scrollTop) 80 } 81 } 82 83 $items.each(function () { 84 let $el = jQuery(this), 85 offsetTop = $el.parent().offset().top 86 87 if (offsetTop >= tempTop && offsetTop <= tempTop+200) { 88 tempDelay += delay; 89 } else { 90 tempTop = offsetTop; 91 tempDelay = 0 92 } 93 94 $el.attr('data-animation-delay', tempDelay) 95 }) 96 97 if (typeof window.SmoothScroll !== 'undefined') { 98 window.SmoothScroll.addListener(function (status) { 99 let scrollTop = status.offset.y + windowHeight 100 101 animationFn(scrollTop) 102 }) 103 } else { 104 jQuery(window).on('scroll', function () { 105 let scrollTop = jQuery(window).scrollTop() + windowHeight 106 107 animationFn(scrollTop) 108 }) 109 } 110 111 112 jQuery(window).on('load added_items', function () { 113 let scrollTop = jQuery(window).scrollTop() + windowHeight 114 115 animationFn(scrollTop) 116 }) 117 118 let scrollTop = jQuery(window).scrollTop() + windowHeight 119 120 animationFn(scrollTop) 121 122 jQuery(window).on('resize', function () { 123 windowHeight = jQuery(window).height() * 1 124 }) 125}
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.