1/** 2 * @name Animations Widget for Template Creator CK 3 * @copyright Copyright (C) 2017. All rights reserved. 4 * @license GNU General Public License version 2 or later; see LICENSE.txt 5 * @author Cedric Keiflin - https://www.template-creator.com - https://www.joomlack.fr - https://www.wp-pluginsck.com 6 */ 7 8(function($) { 9 var TCK_Animations = function(container, options) { 10 var defaults = { 11 replay: '0' // replay animations 12 }; 13 14 var opts = $.extend(defaults, options); 15 var els = $(container); 16 var $window = $(window); 17 18 els.each(function() { 19 var $this = $(this); 20 $window = $(window); 21 22 // function to be called whenever the window is scrolled or resized 23 function update($this){ 24 var top = $this.offset().top; 25 var pos = $window.scrollTop(); 26 var height = $this.height(); 27 var windowheight = $(window).height(); 28 29 // check if totally above or totally below viewport 30 if (top + height < pos || top > pos + windowheight) { 31 if (opts.replay == '1') $this.removeClass('animateck'); 32 return; 33 } 34 // animate the content if found 35 if (top < pos || top > pos + windowheight-30) { 36 // is out of the screen 37 } else { 38 $this.addClass('animateck'); 39 } 40 } 41 update($this); 42 $window.bind('load scroll', function() { update($this); }); 43 // $window.scroll(function() { update($this); }); 44 }); 45 }; 46 window.TCK_Animations = TCK_Animations; 47})(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.