1(function ($) { 2 'use strict'; 3 4 var InitWaypointAnimations = (function () { 5 function onScrollInitAnimation(items, container, options) { 6 const containerOffset = (container) ? container.attr("sa-data-animation-offset") || options.offset : null; 7 items.each(function () { 8 const element = $(this), 9 animationClass = element.attr("sa-data-animation"), 10 animationDelay = element.attr("sa-data-animation-delay") || options.delay, 11 animationDuration = element.attr("sa-data-animation-duration") || options.delay, 12 animationOffset = element.attr("sa-data-animation-offset") || options.offset; 13 14 element.css({ 15 "-webkit-animation-delay": animationDelay, 16 "-moz-animation-delay": animationDelay, 17 "animation-delay": animationDelay, 18 "animation-duration": animationDuration 19 }); 20 21 const trigger = (container) ? container : element; 22 23 // Check if waypoint is available 24 if (typeof $.fn.waypoint === 'function') { 25 trigger.waypoint(function () { 26 element 27 .addClass("animated") 28 .addClass(animationClass); 29 30 }, { 31 triggerOnce: true, 32 offset: containerOffset || animationOffset 33 }); 34 } else { 35 // Fallback: trigger animation immediately if waypoint not available 36 element 37 .addClass("animated") 38 .addClass(animationClass); 39 } 40 }); 41 } 42 43 function InitWaypointAnimations(defaults) { 44 if (!defaults) { 45 defaults = {}; 46 } 47 const options = { 48 offset: defaults.offset || "90%", 49 delay: defaults.delay || "0ms", 50 animateClass: defaults.animateClass || "sa-data-animation", 51 animateGroupClass: defaults.animateGroupClass || "sa-data-animation-group" 52 } 53 54 const animateGroupClassSelector = classToSelector(options.animateGroupClass); 55 const animateClassSelector = classToSelector(options.animateClass); 56 57 // Attach waypoint animations to grouped animate elements 58 $(animateGroupClassSelector).each((index, group) => { 59 const container = $(group); 60 const items = $(group).find(animateClassSelector); 61 onScrollInitAnimation(items, container, options); 62 }); 63 64 // Attach waypoint animations to ungrouped animate elements 65 $(animateClassSelector) 66 .filter((index, element) => { 67 return $(element).parents(animateGroupClassSelector).length === 0; 68 }) 69 .each((index, element) => { 70 onScrollInitAnimation($(element), null, options); 71 }); 72 } 73 74 function classToSelector(className) { 75 return "." + className; 76 } 77 78 return InitWaypointAnimations; 79 }()); 80 81 $(document).ready(function () { 82 InitWaypointAnimations(); 83 }); 84 85 $("[sa-data-animation]").each(function (index, value) { 86 if ($(this).attr('sa-data-animation') !== '') { 87 $(this).addClass('sa-data-animation'); 88 } 89 }); 90 91})(jQuery); 92
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.