回到顶部
<script type="text/javascript"> | |
jQuery.noConflict(); | |
jQuery(function(){ | |
//首先将#back-to-top隐藏 | |
jQuery("#totop").hide(); | |
//当滚动条的位置处于距顶部100像素以下时,跳转链接出现,否则消失 | |
jQuery(function () { | |
jQuery(window).scroll(function(){ | |
if (jQuery(window).scrollTop()>100){ | |
jQuery("#totop").fadeIn(); | |
} | |
else | |
{ | |
jQuery("#totop").fadeOut(); | |
} | |
}); | |
//当点击跳转链接后,回到页面顶部位置 | |
jQuery("#totop").click(function(){ | |
jQuery('body,html').animate({scrollTop:0},500); | |
return false; | |
}); | |
}); | |
}); | |
</script> |
#share a {
- width:
- height:
- position:
- left:
- margin-left:
- cursor:
- bottom:
- text-indent:
- display:
- border:
- transition:
- background:
}
<div id="share"> | |
<a id="totop" title="">返回顶部</a> | |
</div> |
posted on 2015-07-07 17:34 liuwenbohhh 阅读(183) 评论(0) 编辑 收藏 举报
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步