jQuery练习写的简单的手风琴效果

 

<!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>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
        $(function(){
                $(".wrap dl").eq(0).width(740);
                $(".wrap dt").click(function(){
                        $(this).parent("dl").animate({
                                width:"740px"
                        },500).siblings("dl").animate({
                                                        width:"30px"
                        },500);
                });
        });
</script>
<style type="text/css">
* { margin:0; padding:0; }
ul,li { list-style:none; }
.wrap { width:800px; height:245px; margin:10px auto; overflow:hidden; }
.wrap dl { width:30px; height:245px; float:left; overflow:hidden; }
.wrap dt { width:30px; height:245px; float:left; cursor:pointer; text-align:center; }
.wrap dd { margin-left:30px; height:245px; }
</style>
</head>

<body>
<div class="wrap">
  <dl>
    <dt style="background:#090;">菜单一</dt>
    <dd><img src="http://www.w3cfuns.com/data/attachment/album/201205/18/153541iwcbe4kuqkzeuk4w.jpg" width="710" height="245" /></dd>
  </dl>
  <dl>
    <dt style="background:#0099FF;">菜单二</dt>
    <dd><img src="http://www.w3cfuns.com/data/attachment/album/201205/18/1536047c6xjan0tt69omn0.jpg" width="710" height="245" /></dd>
  </dl>
  <dl>
    <dt style="background:#FF6666;">菜单三</dt>
    <dd><img src="http://www.w3cfuns.com/data/attachment/album/201205/18/153523pl70hp67pafjccc7.jpg" width="710" height="245" /></dd>
  </dl>
</div>
</body>
</html>

 

posted @ 2012-07-31 16:20  赵小磊  阅读(192)  评论(0编辑  收藏  举报
回到头部