先放出html代码,如下:
代码: 全选
<ul id="navigation">
<li class="home"><a href="/">Home</a></li>
<li class="about"><a href="http://www.wanmeikongjian.cn/about.html">About Me</a></li>
<li class="search"><a href="http://www.wanmeikongjian.cn/course">课程推荐</a></li>
<li class="photos"><a href="http://www.wanmeikongjian.cn/android">安卓平台</a></li>
<li class="contact"><a href="http://www.wanmeikongjian.cn/teachers/">师资力量</a></li>
<li class="rssfeed"><a href="http://www.wanmeikongjian.cn/jobs">就业保障</a></li>
<li class="podcasts"><a href="http://www.wanmeikongjian.cn/">动漫培训</a></li>
</ul>
<script type="text/javascript">
$(function() {
var d=300;
$('#navigation a').each(function(){
$(this).stop().animate({
'marginTop':'-80px'
},d+=150);
});
$('#navigation > li').hover(
function () {
$('a',$(this)).stop().animate({
'marginTop':'-2px'
},200);
},
function () {
$('a',$(this)).stop().animate({
'marginTop':'-80px'
},200);
}
);
});
</script>
可以自己修改导航的链接和名称,自己修改导航背景图(在修改CSS里面的图片地址)。
然后是CSS代码,如下:
代码: 全选
ul#navigation {
list-style: none outside none;
margin: 0;
padding: 0;
position: fixed;
right: 10px;
top: 0;
width: 721px;
z-index: 999999;
}
ul#navigation li {
display: inline;
float: left;
width: 103px;
}
ul#navigation li a {
background-color: #E7F2F9;
background-position: 50% 10px;
background-repeat: no-repeat;
border: 1px solid #BDDCEF;
border-radius: 0 0 10px 10px;
display: block;
float: left;
height: 30px;
margin-top: -2px;
opacity: 0.7;
padding-top: 80px;
text-align: center;
text-decoration: none;
line-height:30px;
width: 100px;
font-size:13px;
color: #60ACD8;
letter-spacing: 2px;
text-shadow: 0 -1px 1px #FFFFFF;
}
ul#navigation li a:hover {
background-color: #CAE3F2;
}
ul#navigation .home a {
background: url(http://popsong.sinaapp.com/usr/themes/BlueIce/img/home.png) no-repeat;
}
ul#navigation .about a {
background: url(http://popsong.sinaapp.com/usr/themes/BlueIce/img/id_card.png) no-repeat;
}
ul#navigation .search a {
background: url(http://popsong.sinaapp.com/usr/themes/BlueIce/img/search.png) no-repeat;
}
ul#navigation .podcasts a {
background: url(http://popsong.sinaapp.com/usr/themes/BlueIce/img/ipod.png) no-repeat;
}
ul#navigation .rssfeed a {
background: url(http://popsong.sinaapp.com/usr/themes/BlueIce/img/rss.png) no-repeat;
}
ul#navigation .photos a {
background: url(http://popsong.sinaapp.com/usr/themes/BlueIce/img/camera.png) no-repeat;
}
ul#navigation .contact a {
background: url(http://popsong.sinaapp.com/usr/themes/BlueIce/img/mail.png) no-repeat;
}
预览地址可以在这里看