效果就是在页面最右下角的地方有一个小火箭队图标,如下图:
在博客园的设置中,在页首HTML代码中添加如下:
<style> #back-top { position: fixed; bottom: 10px; right: 5px; z-index: 99; } #back-top span { width: 50px; height: 64px; display: block; background:url(http://images.cnblogs.com/cnblogs_com/seanshao/855033/o_rocket.png) no-repeat center center; } #back-top a{outline:none} </style> <script type="text/javascript"> $(function() { // hide #back-top first $("#back-top").hide(); // fade in #back-top $(window).scroll(function() { if ($(this).scrollTop() > 500) { $('#back-top').fadeIn(); } else { $('#back-top').fadeOut(); } }); // scroll body to 0px on click $('#back-top a').click(function() { $('body,html').animate({ scrollTop: 0 }, 500); return false; }); }); </script> <p id="back-top" style="display:none"><a href="#top"><span></span></a></p>
出处:https://www.cnblogs.com/brady-wang/p/11272128.html
标签:function,cnblogs,自定义,博客园,back,---,com,top From: https://www.cnblogs.com/mq0036/p/17502765.html