<div ></span></div>  //bootstrap图标


#gotop{ 
display:none;
font-size: 25px;
color:#fff;
text-align: center;
background: #aaa;
padding:10px 15px;
position:fixed;
right:50px;
bottom:50px;
cursor:pointer;   
}


function goTop()

{
    $(window).scroll(function(e) {
        //若滚动条离顶部大于100元素
        if($(window).scrollTop()>100)
            $("#gotop").fadeIn(1000);//以1秒的间隔渐显id=gotop的元素
        else
            $("#gotop").fadeOut(1000);//以1秒的间隔渐隐id=gotop的元素
    });

};


返回到顶部按钮实现

相关文章: