带缓冲效果自动显示隐藏的返回页面顶部代码
分享一个带缓冲效果的,自动显示隐藏的返回页面顶部的代码。先声明,此代码在ie6下不能正常工作(为了ie6能够早日在中国灭亡,大家都升级浏览器吧!)…其他浏览器均可正常使用
这里用到了jquery,大家可以到官方网站下载最新版本。
html代码:
1 | <div id="top" class="gotop"></div> |
css代码:
1 2 3 4 5 6 7 | /*返回顶部按钮*/ .gotop{ display:none; position:fixed; right:50%; bottom:0;//用fixed定位到页面最底部,右距离为50% width:17px; height:60px; margin-right:-522px; //然后向右移动522px(根据你的需要自行调整) background:url(../images/faq_bg.jpg) no-repeat -662px -269px scroll; cursor:pointer;} |
