1(function($,undefined){ 2 var 3 def={ 4 stuckClass:'isStuck' 5 } 6 ,doc=$(document) 7 8 $.fn.TMStickUp=function(opt){ 9 opt=$.extend(true,{},def,opt) 10 11 $(this).each(function(){ 12 var $this=$(this) 13 ,posY//=$this.offset().top+$this.outerHeight() 14 ,isStuck=false 15 ,clone=$this.clone().appendTo($this.parent()).addClass(opt.stuckClass) 16 ,height//=$this.outerHeight() 17 ,stuckedHeight=clone.outerHeight() 18 ,opened//=$.cookie&&$.cookie('panel1')==='opened' 19 ,tmr 20 21 $(window).resize(function(){ 22 clearTimeout(tmr) 23 clone.css({top:isStuck?0:-stuckedHeight,visibility:isStuck?'visible':'hidden'}) 24 tmr=setTimeout(function(){ 25 posY=$this.offset().top//+$this.outerHeight() 26 height=$this.outerHeight() 27 stuckedHeight=clone.outerHeight() 28 opened=$.cookie&&$.cookie('panel1')==='opened' 29 30 clone.css({top:isStuck?0:-stuckedHeight}) 31 },40) 32 }).resize() 33 34 clone.css({ 35 position:'fixed' 36 ,width:'100%' 37 }) 38 39 $this 40 .on('rePosition',function(e,d){ 41 if(isStuck) 42 clone.animate({marginTop:d},{easing:'linear'}) 43 if(d===0) 44 opened=false 45 else 46 opened=true 47 }) 48 49 doc 50 .on('scroll',function(){ 51 var scrollTop=doc.scrollTop() 52 53 if(scrollTop>=posY&&!isStuck){ 54 clone 55 .stop() 56 .css({visibility:'visible'}) 57 .animate({ 58 top:0 59 ,marginTop:opened?50:0 60 },{ 61 62 }) 63 64 isStuck=true 65 } 66 67 if(scrollTop<posY+height&&isStuck){ 68 $('.js-search').removeClass('active'); 69 clone 70 .stop() 71 .animate({ 72 top:-stuckedHeight 73 ,marginTop:0 74 },{ 75 duration:200 76 ,complete:function(){ 77 clone.css({visibility:'hidden'}) 78 } 79 }) 80 81 isStuck=false 82 } 83 }) 84 .trigger('scroll') 85 }) 86 } 87})(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.