首页  /  留言  /  音乐  /  管理

jquery实现返回页面顶部兼容IE6以及以上版本

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jquery实现返回页面顶部兼容IE6以及以上版本</title>
<script type="text/javascript" src="js/jquery-1.2.6.min.js"></script>
<script language="javascript" type="text/javascript">
$(function(){
$("#db").bind("click",function(){
  $body = (window.opera) ? (document.compatMode == "CSS1Compat" ? $(‘html‘) : $(‘body‘)) : $(‘html,body‘);
  $body.animate({scrollTop: 0},1000);
 })
});
$(window).scroll(function(){
 var $t = document.documentElement.scrollTop
 if($t>0){
  $("#db").fadeIn("slow");//显示
 }else{
  $("#db").fadeOut("slow");//隐藏
 }
})
</script>
<style type="text/css">
*html {
 background-image:url(about:blank);
 background-attachment:fixed;
}
body {
 margin:0px;
 padding:0px;
}
#db {
 width:14px;
 bottom:0;
 border:1px solid #066;
 font-size:12px;
 cursor:pointer;
 position:fixed;
 right:25px;
 z-index:200;
 padding:3px;
 display:none;
 overflow:hidden;
 _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)));
}
</style>
</head>
<body>
<div style="margin:0 auto; background-color:#09C; border:#363 solid 1px; height:8900px; width:900px;"></div>
<div id="db">返回顶部</div>
</body>
</html>
 

作者:Wilber 类别:编程学习 时间:2010/11/15 15:56:25 评论:12 点击231
标签:  webczw,伟博小城,jquery,IE6,兼容
打印:  打印本页
字体:  
本页地址:  http://www.webczw.com/s/2010111515562579716.html
上一篇:架构师给程序员的一封信
下一篇:T-SQL批量替换某字段字符

  评论    
joedontwo
1 F
留言时间:2011/9/20 10:54:51
     auto insurance quotes kju auto insurance yukh
TheatreGlic
2 F
留言时间:2011/9/23 20:10:30
     car insurance :DDD short term health insurance >:[[
muthafudgical
3 F
留言时间:2011/9/23 20:10:32
     car insurance online 8-D life insurance ampv
purplephat
4 F
留言时间:2011/9/26 7:58:34
     prednisone buy lukgo drug generic propecia soma zyrtec xwgrjq
Theuhmaker
5 F
留言时间:2011/9/26 19:05:08
     car insurance rates 44704 health insurance 598
wtfuhz
6 F
留言时间:2011/9/27 23:38:39
     health insurance 21501 cheap car insurance 057269
Jaccoma
7 F
留言时间:2011/9/30 9:44:11
     california health insurance smfhz auto insurance quotes 2428
eg6sir
8 F
留言时间:2011/10/3 12:10:44
     cheap auto insurance tkflv cheap car insurance =((
mentosmomma
9 F
留言时间:2011/10/8 14:14:37
     car insurance quotes uci eastwood auto insurance =[
SalemFU
10 F
留言时间:2011/10/9 19:35:33
     health plus insurance huedle business insurance >:PP
DarkLilac
11 F
留言时间:2011/10/10 9:32:25
     nexium us pharmacy 0785 viagra 8-OO
cheesywillie
12 F
留言时间:2011/10/11 12:00:21
     auto insurance quotes wgraic cheap auto insurance znfp
回复时间:2012/1/29 20:38:38
    This has made my day. I wish all psotigns were this good.
  
昵    称: Wilber
形    象:
内    容:
验证码:   
以上网友发言只代表其个人观点,不代表伟博小城的观点或立场。
  Copyright © 2010 - 2016 WEBCZW.COM, All Rights Reserved
伟博小城  版权所有 网站统计
粤ICP备14091989号