CSS
<style>
<!--
.back-to {
    bottom: 35px;
    overflow: hidden;
    position: fixed;
    right: 10px;
    width: 110px;
    z-index: 999;
}
.back-to .back-top {
    background: url("http://static.wetui.com/img/page-back-top.png") no-repeat scroll 0 0 transparent;
    display: block;
    float: right;
    height: 50px;
    margin-left: 10px;
    outline: 0 none;
    text-indent: -9999em;
    width: 50px;
}
.back-to .back-top:hover {
    background-position: -50px 0
}
-->
</style>
 
HTML
<div style="display:none;" class="back-to" id="toolBackTop">
<a title="返回顶部" onclick="window.scrollTo(0,0);return false;" href="#top" class="back-top">
返回顶部</a>
</div>
 
[先需要引入jQuery库哟!]JS
$j(document).ready(function () {
        var bt = $j('#toolBackTop');
        var sw = $j(document.body)[0].clientWidth;
 
        var limitsw = (sw - 840) / 2 - 80;
        if (limitsw > 0){
                limitsw = parseInt(limitsw);
                bt.css("right",limitsw);
        }
 
        $j(window).scroll(function() {
                var st = $j(window).scrollTop();
                if(st > 30){
                        bt.show();
                }else{
                        bt.hide();
                }
        });
});
 
Image
网页返回顶部浮动图标代码
 网页返回顶部浮动图标代码

相关文章:

  • 2022-12-23
  • 2022-02-12
  • 2022-03-07
  • 2022-12-23
  • 2022-12-23
  • 2021-06-09
  • 2022-01-01
  • 2021-05-25
猜你喜欢
  • 2021-09-21
  • 2021-09-28
  • 2022-02-05
  • 2021-12-13
  • 2022-12-23
  • 2021-12-10
相关资源
相似解决方案