Posted on 2013-05-02 16:49
xcp 阅读(1516)
评论(0) 编辑 收藏 所属分类:
Javascript
<!-- 回到顶部-->
<style>
a.W_gotop {
display: none;
position: fixed;
_position: absolute;
width: 22px;
height: 85px;
line-height: 12px;
left: 50%;
bottom: 100px;
margin-left: 500px;
margin-bottom: 5px;
background-color: #F2F2F2;
border: 1px solid #CCCCCC;
border-radius:2px;
text-align: center;
text-decoration: none;
}
a.W_gotop span {
cursor: pointer;
display: block;
height: 73px;
padding-top: 10px;
border: 1px solid #FFFFFF;
text-decoration: none;
}
a.W_gotop em {
cursor: pointer;
text-decoration: none;
font-style: normal;
font-weight: normal;
}
.icon_gotop{
background: url(images/gotop.png) no-repeat;
}
.W_gotop:hover .icon_gotop {
background: url(images/gotop_focus.png) no-repeat;
}
.W_ico {
display: inline-block;
height: 12px;
width: 12px;
margin-bottom: 5px;
}
.W_txt{
color: #808080;
}
</style>
<a id="base_scrollToTop" class="W_gotop" style="visibility: visible;">
<span>
<em class="W_ico icon_gotop"></em>
<em class="W_txt">返回顶部</em>
</span>
</a>
<script type="text/javascript">
$(function(){
var gotop = $(".W_gotop")
gotop.click(function(){
$("html,body").animate({scrollTop:0},500)
});
$(window).scroll(function(){
if($.browser.msie && ($.browser.version == "6.0") && !$.support.style){//如果IE6
gotop.css({"top":($(window).scrollTop()+$(window).height()-100)+"px","position":"absolute"});
}
if($(window).scrollTop()<=50){
gotop.fadeOut();
}else{
gotop.fadeIn();
}
});
});
名称: ♪4C.ESL | .↗Evon
口号: 遇到新问题♪先要寻找一个方案乄而不是创造一个方案こ
mail: 联系我