//javascript document function chinaz(){ this.init(); } chinaz.prototype = { constructor: chinaz, init: function(){ this._initbacktop(); }, _initbacktop: function(){ var $backtop = this.$backtop = $('
'); $('body').append($backtop); $backtop.click(function(){ $("html, body").animate({ scrolltop: 0 }, 120); }); var timmer = null; $(window).bind("scroll",function() { var d = $(document).scrolltop(), e = $(window).height(); 0 < d ? $backtop.css("bottom", "10px") : $backtop.css("bottom", "-90px"); cleartimeout(timmer); timmer = settimeout(function() { cleartimeout(timmer) },100); }); } } var chinaz = new chinaz();