jquery back to Top (Lite version)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.