jquery 回到顶部,简洁大方
2016-08-02 11:51
357 查看
效果
HTML
<div id="back-to-top" title="返回顶部"><i class="fa fa-chevron-up"></i></div>
style
<style> /*returnTop*/ div#back-to-top { font-size: 40px; position: fixed; display: none; bottom: 100px; right: 60px; cursor: pointer; } </style>
script
<script> $(function () { $(window).scroll(function () { if ($(window).scrollTop() > 200) { $("#back-to-top").fadeIn(1000); } else { $("#back-to-top").fadeOut(1000); } }); //点击返回顶部 $("#back-to-top").click(function () { $('body,html').animate({ scrollTop: 0 }, 1000); return false; }); }); </script>
注意,要引入 font-awesome.css 才可显示图标
相关文章推荐
- [封装插件]Jquery中的CSS处理一览以及回到顶部按钮和鼠标悬停获取坐标的案例
- jquery动态回到顶部特效
- jQuery 跟随浏览器窗口的回到顶部按钮gototop(转)
- Jquery 回到顶部
- 11、jQuery插件之回到顶部插件
- Jquery实现回到顶部
- jquery回到页面顶部代码案例
- jQuery回到顶部的代码
- jQuery回到顶部
- 回到页面顶部的jquery代码
- jquery方法回到顶部代码
- ScrollUp – 超轻量的可定制的回到顶部 jQuery 插件
- jquery插件,回到顶部
- JQuery点击事件回到页面顶部效果
- ScrollUp – 超轻量的可定制的回到顶部 jQuery 插件
- jquery javascript 回到顶部功能
- JQuery之回到顶部的特效
- JQuery实现页面回到顶部
- 自写jquery网页回到顶部效果,渐隐图标,引用js文件就可以
- jQuery 添加收藏夹+设为首页+回到顶部