我用Jquery模拟百度首页【添加服务】伸缩条显示效果,但是我的伸缩条在伸展时,是有好几行往右移的,百度的添加服务伸缩条,是直接一行伸展的,这个效果要如何实现?请大侠们赐教!
以下是我的模拟代码,看看如何改菜能实现。我悬赏60分!<!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>百度伸缩</title>
<link href="css/base.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="wendang/jquery.min.js"></script>
<style type="text/css">
.buttons{
background: #CCCCCC;
float:left;
padding:5px;
width:80px;
text-align:center;
border:1px solid #999;
}
.hover{
cursor:pointer;
background: #FFFFCC;
border:1px solid #000;
}
.nav{
width:0px;
float:left;
background: #DDDDDD;
display:none;
}
.nav li{
width:100px;
float:left;
background:#FFCCCC;
height:19px;
padding:7px 0px 0px 8px;
text-align:center;
}
</style>
<script language="javascript">
$(document).ready(function(){
$('.buttons').hover(
function()
{
$(this).addClass('hover');
},
function(){
$(this).removeClass('hover');
}
);
$('.buttons').click(function()
{
$('.nav').animate({width:440},"slow");
}
);
}
);
</script></head><body>
<div>
<div class="buttons">添加服务</div>
<div class="nav">
<ul>
<li>
广州中山大学
</li>
<li>
数计学院
</li>
<li>
网页设计培训
</li>
<li>
www.s6k8.com
</li>
</ul>
</div>
</div>
</body>
</html>
以下是我的模拟代码,看看如何改菜能实现。我悬赏60分!<!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>百度伸缩</title>
<link href="css/base.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="wendang/jquery.min.js"></script>
<style type="text/css">
.buttons{
background: #CCCCCC;
float:left;
padding:5px;
width:80px;
text-align:center;
border:1px solid #999;
}
.hover{
cursor:pointer;
background: #FFFFCC;
border:1px solid #000;
}
.nav{
width:0px;
float:left;
background: #DDDDDD;
display:none;
}
.nav li{
width:100px;
float:left;
background:#FFCCCC;
height:19px;
padding:7px 0px 0px 8px;
text-align:center;
}
</style>
<script language="javascript">
$(document).ready(function(){
$('.buttons').hover(
function()
{
$(this).addClass('hover');
},
function(){
$(this).removeClass('hover');
}
);
$('.buttons').click(function()
{
$('.nav').animate({width:440},"slow");
}
);
}
);
</script></head><body>
<div>
<div class="buttons">添加服务</div>
<div class="nav">
<ul>
<li>
广州中山大学
</li>
<li>
数计学院
</li>
<li>
网页设计培训
</li>
<li>
www.s6k8.com
</li>
</ul>
</div>
</div>
</body>
</html>
你这个宽度不够。。所以它就多行显示了