jquery back to Top (Lite version)
<!DOCTYPE HTML><HTMLLang= "en"><Head> <MetaCharSet= "UTF-8"> <title>jquery Back to Top</title> <style>*body{background-attachment:fixed;Background-image:URL (about:blank); /*required, anti-jitter*/}*body #toTop{position:Absolute;Top:expression (eval (document.documentelement.scrolltop+ DOCUMENT.DOCUMENTELEMENT.CLIENTHEIGHT-THIS.OFFSETHEIGHT-10)); /*Bottom Fixed suspension*/}#toTop{Display:None;position:fixed;Border:1px solid Red; Right:10px;Bottom:10px;padding:10px 0;cursor:Pointer;} </style></Head><Bodystyle= "height:3000px;"> <DivID= "Totop">Scroll to Top</Div> <Scriptsrc= "Http://apps.bdimg.com/libs/jquery/1.9.1/jquery.js"></Script> <Script> $(function(){ varTotop= $('#toTop'); //triggered when the window scroll bar scrolls$ (window). Scroll (function(){ varSt=$ (window). scrolltop (); //gets the distance that the browser window scrolls up //Tabs tab Bar/console debug Code //document.title = $ (window). scrolltop (); //Console.log ($ (window). scrolltop ()); //determine if the upward scrolling distance is greater than if(St< -) {totop.fadeout ('Fast'); }Else{Totop.fadein ('Fast'); } }); //triggered when a button is clickedTotop.click (function(){ $('html, Body'). Animate ({scrolltop:0 }, -); return false; }); }); </Script></Body></HTML>
jquery back to Top (Lite version)