Well, come in development requirements, when the content of the Web page chicken, the user needs to have a button quickly back to the top, instead of rolling the pulley himself ~
Originally thought more difficult to say, because the above requirements all with JS to achieve, which page reference, which page is displayed.
So, Ben Dick to try to write the next, hmm, did not find, quite easy to say ~ ~
Fart I will soon put, directly on the code, fart put more into a excrement ~ ~ Ah, sin, Amitabha, amen ~ ~
$ (function () {var $btn _top = $ (' <a id= "scrolltop" ></a> '); $ BTN_TOP.CSS ("Display", "none"), $btn _top.css ("width", "40px"), $btn _top.css ("height", "40px"), $btn _top.css (" Position "," fixed "), $btn _top.css (" Right "," 20px "), $btn _top.css (" Bottom "," 100px "), $btn _top.css (" Z-index "," 990 "); $ ("Body"). Append ($btn _top); $ ("body"). On ("click", "#scrollTop", function () {$ ("html,body"). Animate ({scrolltop:0}, " Slow ");}); if ($ (window). scrolltop () >) {$ ("#scrollTop"). FadeIn (600);} $ (window). Scroll (function () {if (window). scrolltop () >) {$ ("#scrollTop"). FadeIn (600);} else{$ ("#scrollTop"). FadeOut (600);}});
Look for a picture of yourself, I use the absolute path "css/web/images/scrolltop.png"
Change the size directly on lines fourth and fifth, which avoids adding cat tags to the page ~ ~ (>^ω^<) Meow ~ ~ ~
Save into a JS file, direct reference, which pain to use, who knows who use ~ ~ ~
There are exchanges please add qq:1740437, welcome advice ~ ~
Also seek the legendary antique hobby small partner, as well as folk music hobby small partner, or shoot video micro movie Small Partner ~ ~