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(true,true).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 25 tmr=setTimeout(function(){ 26 posY=$this.offset().top//+$this.outerHeight() 27 height=$this.outerHeight() 28 stuckedHeight=clone.outerHeight() 29 opened=$.cookie&&$.cookie('panel1')==='opened' 30 31 clone.css({top:isStuck?0:-stuckedHeight}) 32 },40) 33 }).resize() 34 35 clone.css({ 36 position:'fixed' 37 ,width:'100%' 38 }) 39 40 $this 41 .on('rePosition',function(e,d){ 42 if(isStuck) 43 clone.animate({marginTop:d},{easing:'linear'}) 44 45 if(d===0) 46 opened=false 47 else 48 opened=true 49 }) 50 51 doc 52 .on('scroll',function(){ 53 var scrollTop=doc.scrollTop() 54 55 if(scrollTop>=posY&&!isStuck){ 56 57 clone 58 .stop() 59 .css({visibility:'visible'}) 60 .animate({ 61 top:0 62 ,marginTop:opened?50:0 63 },{complete:function(){ 64 65 } 66 }) 67 68 isStuck=true 69 } 70 71 if(scrollTop<posY+height&&isStuck){ 72 clone 73 .stop() 74 .animate({ 75 top:-stuckedHeight 76 ,marginTop:0 77 },{ 78 duration:200 79 ,complete:function(){ 80 clone.css({visibility:'hidden'}) 81 } 82 }) 83 84 isStuck=false 85 } 86 }) 87 .trigger('scroll') 88 }) 89 } 90})(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.