Self-writing jquery web page Back to Top Effect, fade icon, reference js File

Source: Internet
Author: User

Well, come in for development. When there are too many webpages, you need a button to quickly return to the top, instead of rolling the pulley by yourself ~

It was originally difficult to say that the above header should be implemented in Javascript, which page reference and which page display.

As a result, Ben diaosi tried to write it. Well, I didn't find it. It's quite easy to say ~~


If there is a fart, I will be able to put it on the Code directly. If there is more fart, it will become a shit ~~ Oh, sin, Amitabha, amen ~~


$(function(){var $btn_top = $('');$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() > 100){$("#scrollTop").fadeIn(600);}$(window).scroll(function(){if($(window).scrollTop() > 100){$("#scrollTop").fadeIn(600);}else{$("#scrollTop").fadeOut(600);}});});

Find an image by yourself. Here I use the absolute path "http://www.bkjia.com/uploads/allianz 140529/01395kz7-0.png"

You can directly change the size of Line 4 and line 5 to avoid adding cat labels on the page ~~ (> ^ ω ^ <) Meow ~~~

Save it as a js file and reference it directly ~~~


Please add QQ: 1740437 for communication. Thank you for your advice ~~

In addition, I also sought from the legendary friends who love the ancient style, as well as those who love the folk music, or those who want to film micro-movies ~~


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.