Home>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>untitled page</title>
<script src="jquery-1.7.2.min.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;
      width:160px;
    }
    .menutitle
    {
      width:100%;
      height:26px;
      border-bottom:0px #ccccff solid;
      border-top:1px #ccccff solid;
      text-align:left;
      line-height:26px;
      cursor:pointer;
    }
    ul
    {
      border:0px #ccccff solid;
      width: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 runat="server">
  <div>
    <div>
      title1</div>
    <ul>
      <li>menu1</li>
      <li>menu2</li>
      <li>menu3</li>
      <li>menu4</li>
      <li>menu5</li>
    </ul>
    <div>
      title2</div>
    <ul>
      <li>menu1</li>
      <li>menu2</li>
      <li>menu3</li>
      <li>menu4</li>
      <li>menu5</li>
    </ul>
    <div>
      title3</div>
    <ul>
      <li>menu1</li>
      <li>menu2</li>
      <li>menu3</li>
      <li>menu4</li>
      <li>menu5</li>
    </ul>
  </div>
  </form>
</body>
</html>
  • Previous jQuery + css achieves a very beautiful horizontal navigation menu effect
  • Next Summary of Yii2's introduction methods for generating specified URLs and pictures