1.JS代码
$(document).ready(function(){
$("#scrolltop").hide();
$(function () {
$(window).scroll(function(){
if ($(window).scrollTop()>100){
$("#scrolltop").fadeIn(400);
}else{
$("#scrolltop").fadeOut(400);
}
});
$("#scrolltop").click(function(){
$('body,html').animate({scrollTop:0},400);
return false;
});
});
});
2.DIV代码
<div id="scrolltop" style="left: 1191px; visibility: visible;">
<span hidefocus="true"><a title="返回顶部" class="scrolltopa"><b>返回顶部</b></a></span>
</div>