UNPKG

fd-gulp-convert-encoding

Version:

convert file to assigned charset

86 lines (63 loc) 1.65 kB
;(function($){ var self; var defConfig = { "element": "#floating_box", //��Ҫ�����Ļض������� "goTopBtn": "a.goTopBtn", //��Ҫ���¼���Ԫ�� "contanerEle": "div.mainContentWrap", "rootId": "#content" } function GoTop(sb) { Sandbox = sb; return GoTop; } $.extend(GoTop,{ init: function(){ self = this; self.isIE6 = false; self.goTopWrap = $(defConfig.element); if( $.browser.version === "6.0" ) { var fromBottom = self.goTopWrap.css("bottom"); self.fromTop = $(window).height() - parseInt(fromBottom,10)-100; self.isIE6 = true; }else{ self.isIE6 = false; } self._bindEvent(); $(window).trigger("scroll"); }, _bindEvent: function() { $(window).bind("scroll",function(){ if( $(window).scrollTop() > 600 ){ self.goTopWrap.fadeIn(); }else{ self.goTopWrap.fadeOut(); } if( self.isIE6 ){ self._fixIE6(); } }); $(window).bind("resize",function(){ if( self.isIE6 ){ self._fixIE6(); } }); $(defConfig.goTopBtn,defConfig.element).click(function(e){ e.preventDefault(); $('body,html').animate({ "scrollTop": 0 },300,'linear'); }); }, _fixIE6: function() { var top = $(window).scrollTop() + self.fromTop; self.goTopWrap.css({ "position": "absolute", "top": top }); }, end: 0 }); Qingguo.Widget.GoTop = GoTop; // AppCore.register("qingguo_mod_gotop", Qingguo.Widget.GoTop); AppCore.lazyRegister("qingguo_mod_gotop", "Qingguo.Widget.GoTop", window, 'scroll'); })(jQuery);