<a href="javascript:;" class="gotop" id="scroll" sty>返回顶部</a>
<script type="text/javascript">
$(function(){
showScroll();
function showScroll(){
$(window).scroll( function() {
var scrollValue=$(window).scrollTop();
scrollValue > 100 ? $('.gotop').fadeIn():$('.gotop').fadeOut();
} );
$('#scroll').click(function(){
$("html,body").animate({scrollTop:0},500);
});
}
})
</script>
网友评论