jquery最简单的右侧返回顶部代码(滚动才出现)
2013-09-04 11:47
507 查看
<div style="display:none;" id="gotopbtn" class="to_top"><a title="返回顶部" href="javascript:void(0);"></a></div> <script type="text/javascript"> $(function(){ $(window).scroll(function(){ $(window).scrollTop()>200 ? $("#gotopbtn").css('display','').click(function(){ $(window).scrollTop(0); }):$("#gotopbtn").css('display','none'); }); }); </script>
CSS代码
.to_top a,.to_top a:hover{ background:url(../images/gotop1_03.gif) no-repeat;} .to_top a{ background-position:0 0;float:left;height:83px;overflow:hidden;width:25px;position:fixed;bottom:35px;cursor:pointer;right:20px; _position:absolute; _right:auto; _left:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-this.offsetWidth)-(parseInt(this.currentStyle.marginLeft, 10)||0)-(parseInt(this.currentStyle.marginRight, 10)||20)); _top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop, 10)||20)-(parseInt(this.currentStyle.marginBottom, 10)||20))); } .to_top span{ background:url(../images/gotop1_03.gif) no-repeat;} .to_top span{ background-position:0 0;float:left;height:83px;overflow:hidden;width:25px;position:fixed;bottom:35px;cursor:pointer;right:20px; _position:absolute; _right:auto; _left:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-this.offsetWidth)-(parseInt(this.currentStyle.marginLeft, 10)||0)-(parseInt(this.currentStyle.marginRight, 10)||20)); _top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop, 10)||20)-(parseInt(this.currentStyle.marginBottom, 10)||20))); }
相关文章推荐
- jquery实现鼠标向下滚动右侧才出现返回顶部链接
- jQuery 简单返回顶部代码
- 一个简单的返回顶部jQuery代码
- 一个简单的返回顶部jQuery程序代码
- “返回顶部代码”滑动效果 jQuery超级简单实用写法
- JQUERY右侧悬浮返回顶部代码
- 一句jQuery代码实现返回顶部效果(简单实用)
- jquery实现鼠标向下滚动右侧才出现返回顶部链接
- jquery 实现简单返回顶部代码
- 简单返回顶部代码及注释说明
- 简单返回顶部代码及注释说明
- jquery小火箭返回顶部代码分享
- 一个简单的 弹性返回顶部JS代码
- jQuery实现的个性化返回底部与返回顶部特效代码
- 如何用jquery写一个简单的返回顶部
- 基于Jquery返回顶部代码html+css+js
- JQuery简单实现锚点链接的平滑滚动(一段代码控制所有锚点)
- backtop返回页面顶部jquery代码
- jquery配合css简单实现返回顶部效果
- 简单返回顶部代码及注释说明