以下是 jQuery油漆动态刷墙效果导航js代码 的示例演示效果:
部分效果截图:
HTML代码(index.html):
<!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油漆动态刷墙效果导航</title>
<style type="text/css">
*{margin:0;padding:0;list-style-type:none;}
a,img{border:0;}
body{font:12px/180% Arial, Helvetica, sans-serif, "新宋体";}
/* nav */
#nav{width:880px;height:570px;margin:0 auto;background:url(images/bg.jpg) no-repeat;padding:15px;}
#nav ul li{float:left;margin-left:15px;display:inline;}
#nav ul li a{text-align:center;display:block;width:92px;height:40px;line-height:40px;position:relative;font-size:14px;color:#fff;text-decoration:none;}
li.home a{background:url(images/q.png) 0 0 no-repeat;}
li.work a{background:url(images/q.png) -95px 0 no-repeat;}
li.art a{background:url(images/q.png) -190px 0 no-repeat;}
li.about a{background:url(images/q.png) -285px 0 no-repeat;}
li.connect a{background:url(images/q.png) -380px 0 no-repeat;}
</style>
<script type='text/javascript' src='js/jquery.min.js'></script>
<script type="text/javascript">
$(function(){
$('#nav ul li a').hover(function(){
$(this).stop().animate({height:"208px"},600);
},function(){
$(this).stop().animate({height:"40px"},600);
});
//Work
$('#nav ul li.work a').hover(function(){
$(this).stop().animate({height:"163px"},600);
},600);
//Art
$('#nav ul li.art a').hover(function(){
$(this).stop().animate({height:"189px"},600);
},600);
//About
$('#nav ul li.about a').hover(function(){
$(this).stop().animate({height:"126px"},600);
},600);
//Connect
$('#nav ul li.connect a').hover(function(){
$(this).stop().animate({height:"139px"},600);
},600);
});
</script>
</head>
<body>
<div id="nav">
<ul>
<li class="home"><a href="#">Home</a></li>
<li class="work"><a href="#">Work</a></li>
<li class="art"><a href="#">Art</a></li>
<li class="about"><a href="#">About</a></li>
<li class="connect"><a href="#">Connect</a></li>
</ul>
</div>
</body>
</html>