• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
阳光Angel
博客园    首页    新随笔    联系   管理    订阅  订阅
折叠菜单slideUp

<!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" />
<link rel="stylesheet" href="css/style.css" type="text/css" />
<link rel="stylesheet" href="css/reset.css" type="text/css" />

<title>无标题文档</title>
</head>

<body>
<div id="menu">
    <h1>菜单1</h1>
    <ul class="show">
       <li>菜单1.1</li>
       <li>菜单1.2</li>
       <li>菜单1.3</li>
    </ul>
   
    <h1>菜单2</h1>
    <ul>
       <li>菜单2.1</li>
       <li>菜单2.2</li>
       <li>菜单2.3</li>
    </ul>
   
    <h1>菜单3</h1>
    <ul>
       <li>菜单3.1</li>
       <li>菜单3.2</li>
       <li>菜单3.3</li>
    </ul>
</div>
</body>
</html>
<script src="js/jQuery1.7.js"></script>
<script src="js/menu.js"></script>

 

 

 

@charset "utf-8";
/* CSS Document */
body{padding:0px;margin:0px; font-size:12px; font-family:"宋体"}
ul,ol,dl,dd,dt,h1,h2,h3,h4,p,span,form,input,tr,td{padding:0px; margin:0px;}
ul,ol{ list-style:none;}
img{border:none;}
a{ text-decoration:none; color:#333;}
.clear{ clear:both}
img,input{ vertical-align:middle;}

#menu{ width:300px; border:1px solid #09C; margin:100px auto;}
#menu h1{ height:25px; background:#ccc; color:#333; font-size:14px; font-weight:bolder; line-height:25px; text-align:center;cursor:pointer;}
#menu ul{ display:none;}
#menu .show{ display:block;}
#menu li{ height:20px; background:#999; color:#000; line-height:20px; text-align:center; }
#menu li.hover{ background:#0f0;}

 

 

 

 

 
$(document).ready(function(){
 $("h1").bind("click",function(){
  $("ul").hide();       
  $(this).next().slideDown();  }); 
         
  $("li").bind("mouseover",function(){
           
   $(this) .addClass("hover");  }).bind("mouseout",function(){
       $(this).removeClass("hover"); 
    });      
   
                         
     });   
      

 

 

posted on 2013-06-21 17:26  xiaoleilei  阅读(275)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3