1(function () { 2 jQuery(document).ready(function ($) { 3 var dataprefix = "data-sticky"; 4 5 function attrName(name) { 6 return name ? dataprefix + "-" + name : dataprefix; 7 } 8 9 var stickyElements = $('[' + dataprefix + ']'); 10 stickyElements.each(function (index, el) { 11 var $el = $(el); 12 13 if ($el.data('stickData')) { 14 return; 15 } 16 17 var distance = parseInt($el.attr(attrName())); 18 var stickyOnMobile = $el.attr(attrName("mobile")) == "1"; 19 var stickyOnTablet = true; //$el.attr(attrName("tablet")) == "1" ; 20 var useShrink = $el.attr(attrName("shrinked")) == "1"; 21 var toBottom = $el.attr(attrName("to")) == "bottom"; 22 23 if (useShrink) { 24 $el.attr(attrName(), "initial"); 25 } 26 27 var stickData = { 28 center: true, 29 responsiveWidth: true, 30 zIndex: (20 + index), 31 topSpacing: distance, 32 stickyOnMobile: stickyOnMobile, 33 stickyOnTablet: stickyOnTablet, 34 useShrink: useShrink, 35 toBottom: toBottom, 36 useNativeSticky: false 37 } 38 39 if (useShrink) { 40 return; 41 } 42 43 if (distance === 0 && jQuery('#wpadminbar').length && jQuery('#wpadminbar').css('position') === "fixed") { 44 // distance = jQuery('body').offset().top; 45 } 46 47 stickData['topSpacing'] = distance; 48 stickData['top'] = distance; 49 50 $el.data('stickData', stickData); 51 $el.fixTo('body', stickData); 52 }); 53 54 var resizeCallback = function () { 55 var stickyElements = this.$els; 56 57 if (window.innerWidth < 1024) { 58 stickyElements.each(function (index, el) { 59 var data = $(this).data(); 60 var stickData = data.stickData; 61 62 if (!stickData) { 63 return; 64 } 65 66 var fixToInstance = data.fixtoInstance; 67 if (!fixToInstance) 68 return true; 69 70 if (window.innerWidth <= 767) { 71 if (!stickData.stickyOnMobile) { 72 fixToInstance.stop(); 73 } 74 } else { 75 if (!stickData.stickyOnTablet) { 76 fixToInstance.stop(); 77 } 78 } 79 }); 80 } else { 81 stickyElements.each(function (index, el) { 82 var data = $(this).data(); 83 if (!data) { 84 return; 85 } 86 var fixToInstance = data.fixtoInstance; 87 if (!fixToInstance) 88 return true; 89 fixToInstance.start(); 90 }) 91 } 92 } 93 .bind({ 94 "$els": stickyElements 95 }) 96 97 $(window).bind('resize.sticky orientationchange.sticky', function () { 98 setTimeout(resizeCallback, 50); 99 }); 100 $(window).trigger('resize.sticky'); 101 }); 102 103})()
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.