JQ返回顶部代码分享~~~~
2014-04-28 11:58
399 查看
1.jq代码:
1.css代码:
<script type="text/javascript"> $(function() { $("#tbox").click(scrollToTop); }); function scrollToTop() { $("body,html").animate({ scrollTop: 0 }, 600); return false; } </script>
<script type="text/javascript"> function scrollToTop() { $("body,html").animate({ scrollTop: 0 }, 600); return false; } $(function() { // $("#tbox").hide(); $(window).scroll(function() { if ($(this).scrollTop() > 100) { $("#tbox").fadeIn(); } else { $("#tbox").fadeOut(); } }); $("#atop").click(scrollToTop); }); </script>
1.css代码:
*{ padding:0px; margin:0px;} *html{background-image:url(about:blank);background-attachment:fixed;}/*解决IE6下滚动抖动的问题*/ #tbox{float:right; position:fixed; right:2px; bottom:20px; _position:absolute; _bottom:auto; _top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)));_margin-bottom:20px;}/*解决IE6下不兼容 position:fixed 的问题*/
相关文章推荐
- jQ 移动端返回顶部代码整理
- 基于JQ返回顶部代码
- 不但要返回顶部,还要返回底部,小改变,实用,?scroll?的js代码,支持IE,FF,chrome[摘自布布分享,tech.bubufx.com]
- jquery小火箭返回顶部代码分享
- jquery小火箭返回顶部代码分享
- 简单返回顶部代码及注释说明(转载自cnblogs)
- 返回顶部完整代码
- 弹性返回顶部JS代码
- 返回顶部浮动图标代码
- 带在线客服返回顶部的jquery右下角弹出菜单-代码
- CSS-返回顶部代码
- “返回顶部”代码
- 返回顶部完整代码
- 返回顶部,最精简代码,带注释
- 20款网页常用的返回顶部代码
- 一行代码搞定使用LinearLayoutManager一键返回顶部
- 返回到顶部代码
- js,javascript,jquery网页返回顶部代码
- 弹性返回顶部JS代码
- JavaScript原生代码实现返回顶部缓动效果