Jquery+CSS朴素切换菜单

一定要有jquery132min.js文件引用哦................

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>

    <script src="jquery132min.js" type="text/javascript"></script>

    <script type="text/javascript">
         $(function(){
             toggleEvent(0);
             var mTitle  = $(".menuTitle");
             mTitle.each(function(i){               
                $(this).click(function(){                
                  toggleSlideEvent(i);
                  $(this).css("border-bottom","1px #ccccff solid");
                });
             });            
         });
         function toggleSlideEvent(i)
         {
            $("ul",".menu1").css("display","none");                                               
            $("ul",".menu1").eq(i).slideDown();
           
            $(".menuTitle").each(function(){
               $(this).css("border-bottom","0px #ccccff solid");
            });
         }
         function toggleEvent(i)
         {
            $("ul",".menu1").css("display","none");
            $("ul",".menu1").eq(i).css("display","block");
            $(".menuTitle").eq(i).css("border-bottom","1px #ccccff solid");
         }
    </script>

    <style type="text/css">
        .menu1
        {
            border: 1px #CCCCFF solid;
            border-top: 0px;
            160px;
        }
        .menuTitle
        {
            100%;
            height: 26px;
            border-bottom: 0px #CCCCFF solid;
            border-top: 1px #CCCCFF solid;
            text-align: left;
            line-height: 26px;
            cursor: pointer;
            background:url(images/mid-nei-bg_02.gif);
        }
        ul
        {
            border: 0px #CCCCFF solid;
            100%;
            margin-left: 0px;
            margin-top: 0px;
        }
        ul li
        {
            height: 36px;
            line-height:36px;
            border: 0px gray solid;
            margin-top: 0px;
            margin-left: 0px;
            padding-left:20px;
            list-style-type:none;           
            /*background:url(images/Title.png);*/
        }
        ul li:hover
        {
            height: 36px;
            line-height:36px;
            border: 0px gray solid;
            margin-top: 0px;
            margin-left: 0px;
            padding-left:20px;
            list-style-type:none;           
            /*background:url(images/Title.png);*/
            cursor:pointer;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div class="menu1">
        <div class="menuTitle">
            TITLE1</div>
        <ul>
            <li>Menu1</li>
            <li>Menu2</li>
            <li>Menu3</li>
            <li>Menu4</li>
            <li>Menu5</li>
        </ul>
        <div class="menuTitle">
            TITLE2</div>
        <ul>
            <li>Menu1</li>
            <li>Menu2</li>
            <li>Menu3</li>
            <li>Menu4</li>
            <li>Menu5</li>
        </ul>
        <div class="menuTitle">
            TITLE3</div>
        <ul>
            <li>Menu1</li>
            <li>Menu2</li>
            <li>Menu3</li>
            <li>Menu4</li>
            <li>Menu5</li>
        </ul>
    </div>
    </form>
</body>
</html>

原文地址:https://www.cnblogs.com/ajun/p/2185148.html