1/** 2* Jquery floater ·¹À̾ Ç×»ó ȸ鿡 ¶°Àְųª µû¶ó ´Ù´Ïµµ·Ï ó¸® 3* 4* options 5* 6* allwaysTop : true , Ç×»ó À§ false µû¶ó´Ù´Ïµµ·Ï 7* speed : 1000 µû¶ó´Ù´Ï´Â ¼Óµµ 8* bottom : false Ç×»ó ÇÏ´Ü¿¡ 9* default_x : Áß¾ÓÁ¤·ÄÀ϶§ ¿¤¸®¸ÕÆ® ¿·¿¡ Äü¸Þ´º ºÙÈ÷±â 10* 11* @since 2009-10-30 12* @author jsyang <[email protected]> 13* @version 1 14* 15*/ 16(function($) { 17 18 $.extend($.fn, { 19 Floater : function(setting) 20 { 21 var options = $.extend($.fn.Floater.defaults, setting); 22 var box = this; 23 var initTop = options.initTop; 24 25 if(options.bottom) { 26 bottom_pos = $(window).height() - $(box).height() - initTop; 27 $(box).css('top' , bottom_pos); 28 initTop = bottom_pos; 29 } 30 31 if(options.default_x) { 32 box.css('left' , getX($(options.default_x)) ); 33 if(box.css('display')=='none') box.css('display','block'); 34 35 $(window).bind('resize', function() { 36 box.css('left' , getX($(options.default_x))); 37 }); 38 39 } 40 41 var prevTop = initTop; 42 43 $(window).bind('scroll', function(e){adjustTop();}); 44 45 function getX(el) 46 { 47 return el.get(0).offsetLeft + el.width(); 48 }; 49 50 function adjustTop() 51 { 52 var newTop = computeTop(); 53 if (newTop <= initTop) newTop = initTop; 54 if (prevTop != newTop) { 55 layerMove(newTop); 56 prevTop = newTop; 57 } 58 }; 59 60 function layerMove(dest) 61 { 62 if(options.alwaysTop) { 63 //var posx=$(window).scrollLeft() + $(window).width() - $(box).width(); 64 $(box).css({'top': dest}); 65 }else{ 66 $(box).stop(); 67 $(box).animate({'top': dest},{'duration':options.speed}); 68 } 69 }; 70 71 function computeTop() 72 { 73 return $(window).scrollTop() + initTop; 74 }; 75 } 76 77 }); 78 79 $.fn.Floater.defaults = { 80 'alwaysTop' : true , 81 'bottom' : false , 82 'default_x' : false , 83 'initTop' : 50 , 84 'speed' : 30 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.