Wrote a component on the top of a jquery-based return page.
(function($) { varg; $.backtop=function(options) {Extend ($.backtop.config, options); This. config =$.backtop.config; This. Init (); G= This; }; $.backtop.config={title:NULL,//return to top text descriptionDf_color: "#77AA55"//Component Default Color}; $.backtop.prototype={config:NULL, Backtop:NULL,//current creation returns top ObjectInit:function() { This. _scrool ();}, _scrool:function() {Window.onscroll=function() {g._create_ob (window). scrolltop ());}, _create_ob:function(top) {if(top==0){ $("#back_top"). Remove (); return; } $("#back_top"). Remove (); This. Backtop = $ ("<div class= ' mouseover ' ></img></div>"); $( This. Backtop). Bind ("click",function() {G._moveto ();}); $( This. Backtop). Bind ("MouseOver",function() {$ (g.backtop). Removeclass (); $ (g.backtop). addclass ("Mouse"); }); $( This. Backtop). Bind ("Mouseout",function() {$ (g.backtop). Removeclass (); $ (g.backtop). addclass ("MouseOver"); }); $( This. backtop). attr ("id", "back_top"); /*$ (this.backtop). CSS ("BackgroundColor", This.config.df_color);*/ $( This. backtop). CSS ("ZIndex", 1000); $( This. backtop). CSS ("position", "absolute"); $( This. backtop). CSS ("cursor", "pointer"); $( This. backtop). Width (30); $( This. backtop). Height (30); $( This. backtop). CSS ("left", $ ("body"). attr ("ClientWidth")-50); $( This. backtop). CSS ("Top", top+300); $("Body"). Append ( This. Backtop); },//Create a back top jquery object_moveto:function(){ $("#back_top"). Remove (); Window.Scroll (0,0); } }; }) (JQuery); varExtend =function($CF, options) { for(varAinchoptions) {$CF [a]=options[a];} };
jquery returns to the top component