JQ返回顶部代码分享~~~~
生活随笔
收集整理的這篇文章主要介紹了
JQ返回顶部代码分享~~~~
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?
1.jq代碼:
<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 的問題*/?
?
?
轉載于:https://www.cnblogs.com/ninali/p/3696048.html
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的JQ返回顶部代码分享~~~~的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 分期乐多久轰炸通讯录
- 下一篇: 光大炎黄金卡好提额吗