Skip to content

Commit

Permalink
fix #2
Browse files Browse the repository at this point in the history
  • Loading branch information
luckid committed Jul 12, 2012
1 parent 11b2364 commit 5fea0dc
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 40 deletions.
Binary file added luckid_ubuntu/a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed luckid_ubuntu/backtop.png
Binary file not shown.
26 changes: 7 additions & 19 deletions luckid_ubuntu/footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,11 @@

wp_footer();
?>
<div id="gotopbtn"></div>
<script type="text/javascript">
backTop=function (btnId){
var btn=document.getElementById(btnId);
var d=document.documentElement;
window.onscroll=set;
btn.onclick=function (){
btn.style.display="none";
window.onscroll=null;
this.timer=setInterval(function(){
d.scrollTop-=Math.ceil(d.scrollTop*0.1);
if(d.scrollTop==0) clearInterval(btn.timer,window.onscroll=set);
},10);
};
function set(){btn.style.display=d.scrollTop?'block':"none"}
};
backTop('gotopbtn');
</script>
</body>

<div class="go">
<a title="到顶部" class="top" href="#top">至顶</a>
<a title="到底部" class="bottom" href="#bottom">至底</a>
</div>

<a name="top" id="bottom"></a></body>
</html>
2 changes: 1 addition & 1 deletion luckid_ubuntu/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
?>
</head>

<body <?php body_class(); ?>>
<body <?php body_class(); ?>><a name="top" id="top"></a>
<div id="wrapper" class="hfeed">
<div id="header">
<?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>
Expand Down
65 changes: 45 additions & 20 deletions luckid_ubuntu/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,13 @@ a:visited
}
*/
#wrapper {
background: white;
-moz-box-shadow: 0 0 2px #bbb;
-webkit-box-shadow: 0 0 2px #bbb;
-moz-border-radius: 0 0 4px 4px;
-webkit-border-radius: 0 0 4px 4px;

position: relative;

background: white;
-moz-box-shadow: 0px 0px 5px #999;
-webkit-box-shadow: 0px 0px 5px #999;
box-shadow: 0px 0px 5px #999;
-moz-border-radius: 0 0 4px 4px;
-webkit-border-radius: 0 0 4px 4px;
position: relative;
}

#header ul
Expand Down Expand Up @@ -825,18 +824,44 @@ text-align: center;
font-weight: bold;
}

#gotopbtn {
width:49px;
height:64px;
background:url(./backtop.png) no-repeat;
/* go to top and bottom */
.go{
width:40px;
height:100px;
background-color:#FFF;
position:fixed;
left:50%;
margin-left:492px;
bottom:125px;
display:none;
cursor:pointer;

_position:absolute;
left:50%;
margin-left:500px;
bottom:105px;
border-radius:5px;
box-shadow:0 0 3px #1E1E1E;
-moz-box-shadow:0 0 3px #1E1E1E;
-webkit-box-shadow:0 0 3px #1E1E1E
}

z-index:99;
}
.go a{
background:url(./a.png) no-repeat;
display:block;
line-height:999px;
width:40px;
margin:0px;
border:0;
overflow:hidden;
float:left
}
.go .top{
background-position:-20px -20px;
height:50px
}

.go .bottom{
background-position:-20px -70px;
height:50px
}
.go .top:hover{
background-position:-80px -20px
}
.go .bottom:hover{
background-position:-80px -71px
}

1 comment on commit 5fea0dc

@luckid
Copy link
Owner Author

@luckid luckid commented on 5fea0dc Jul 12, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

弃用javascript跳转的方式,改用最简单的锚标记跳转。更新按钮的UI

Please sign in to comment.