我用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>

解决方案 »

  1.   

    $('.nav').animate({width:440},"slow");
    你这个宽度不够。。所以它就多行显示了
      

  2.   

    不是这个问题吧,我改到width:900 ,它初始伸出来的时候还是会先是几行再变成一行,我要的是它初始时是在一行内向右伸,就像www.baidu.com 的一样
      

  3.   

    经过1天的琢磨,好了,我自己已经做好了!现在共享给大家~~~Enjoy It~【百度登录后的添加服务伸缩条教程】源码观看地址:http://www.s6k8.com/wyjc/wyjc_362.html全部源码下载地址 :http://download.csdn.net/detail/kathy3bg/3752243