<div id="gotop"><span class="glyphicon glyphicon-chevron-up"></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的元素
});
};