1(function ( $ ) { 2 3 // Default settings, you should change them by calling the .prettyfit function 4 var settings = { 5 destroy: false 6 7 }; 8 9 $.fn.responsivesticky = function (options) { 10 // Override default settings 11 if (options) { 12 settings = $.extend(settings, options); 13 } 14 15 // The for each is needed to treat each element 16 return this.each(function() { 17 18 var stickyDiv = jQuery(this); 19 20 if (!settings.destroy) { 21 22 var maxscrollheight = (jQuery(stickyDiv).parent().offset().top + jQuery(stickyDiv).parent().outerHeight()) - (jQuery(stickyDiv).outerHeight() + 50); 23 24 if(jQuery(window).scrollTop() + 50 > jQuery(stickyDiv).parent().offset().top && jQuery(window).scrollTop() < maxscrollheight) { 25 sticky(stickyDiv); 26 } 27 28 jQuery(window).scroll(function(){ // scroll event 29 30 if (jQuery(window).scrollTop() + 50 > jQuery(stickyDiv).parent().offset().top && jQuery(window).scrollTop() < maxscrollheight && !settings.destroy) { 31 sticky(stickyDiv); 32 } else if (jQuery(window).scrollTop() > maxscrollheight && !settings.destroy) { 33 stickyAtTheBottom(stickyDiv); 34 } else { 35 stickyReset(stickyDiv); 36 } 37 38 }); 39 40 } else { 41 stickyReset(stickyDiv); 42 } 43 44 }); 45 46 }; 47 48 function sticky(stickyDiv) { 49 50 var stickyMarginTop = 50; 51 jQuery(stickyDiv).css({'top': stickyMarginTop, 'position': 'fixed', 'left': jQuery(stickyDiv).offset().left}); 52 53 } 54 55 function stickyAtTheBottom(stickyDiv) { 56 57 jQuery(stickyDiv).removeAttr("style"); 58 jQuery(stickyDiv).css({'bottom': 0, 'position': 'absolute'}); 59 60 } 61 62 function stickyReset(stickyDiv) { 63 64 jQuery(stickyDiv).css({'top': 0, 'left': 0, 'position': 'relative'}); 65 66 } 67 68}( 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.