1 2 $.fn.stickyfloat = function(options, lockBottom, mintop) { 3 var obj = this; 4 var parentPaddingTop = parseInt(obj.parent().css('padding-top')); 5 var startOffset = obj.parent().offset().top; 6 var opts = $.extend({ startOffset: startOffset, offsetY: parentPaddingTop, duration: 200, lockBottom:true }, options); 7 8 obj.css({ position: 'absolute' }); 9 10 if(opts.lockBottom){ 11 var bottomPos = obj.parent().height() - obj.height() + parentPaddingTop; //get the maximum scrollTop value 12 if( bottomPos < 0 ) 13 bottomPos = 0; 14 } 15 16 $(window).scroll(function () { 17 obj.stop(); // stop all calculations on scroll event 18 19 var pastStartOffset = $(document).scrollTop() > opts.startOffset; // check if the window was scrolled down more than the start offset declared. 20 var objFartherThanTopPos = obj.offset().top > startOffset; // check if the object is at it's top position (starting point) 21 var objBiggerThanWindow = obj.outerHeight() < $(window).height(); // if the window size is smaller than the Obj size, then do not animate. 22 23 // if window scrolled down more than startOffset OR obj position is greater than 24 // the top position possible (+ offsetY) AND window size must be bigger than Obj size 25 if( (pastStartOffset || objFartherThanTopPos) && objBiggerThanWindow ){ 26 var newpos = ($(document).scrollTop() -startOffset + opts.offsetY ); 27 if ( newpos > bottomPos ) 28 newpos = bottomPos; 29 if ( $(document).scrollTop() < opts.startOffset ) // if window scrolled < starting offset, then reset Obj position (opts.offsetY); 30 newpos = parentPaddingTop; 31 if(newpos < mintop) 32 newpos = mintop; 33 obj.animate({ top: newpos }, opts.duration ); 34 } 35 }); 36 };
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.