asimryu

css3 & jquery slidedown menu

Jul 22nd, 2014
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.46 KB | None | 0 0
  1. <!doctype html>
  2. <html lang="ko">
  3. <head>
  4. <meta charset="UTF-8">
  5. <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
  6. <style>
  7.     body {
  8.       font-family: Gullim;
  9.       font-size: 13px;
  10.       text-align: center;
  11.       background: #E3CAA1;
  12.     }
  13.  
  14.     ul {
  15.       text-align: left;
  16.       display: inline;
  17.       margin: 0;
  18.       padding: 0;
  19.       list-style: none;
  20.     }
  21.     ul li {
  22.       font-weight: bold;
  23.       display: inline-block;
  24.       margin-right: -4px;
  25.       position: relative;
  26.       padding: 15px 20px;
  27.       background: #fff;
  28.       cursor: pointer;
  29.     }
  30.     ul li:hover {
  31.       background: #555;
  32.       color: #fff;
  33.     }
  34.     ul li ul {
  35.       padding: 0;
  36.       position: absolute;
  37.       top: 45px;
  38.       left: 0;
  39.       width: 150px;
  40.       display: none;
  41.       visibility: hidden;
  42.     }
  43.     ul li ul li {
  44.       background: #555;
  45.       display: block;
  46.       color: #fff;
  47.     }
  48.     ul li ul li:hover { background: #666; }
  49.     /*
  50.     ul li:hover ul {
  51.       display: block;
  52.       visibility: visible;
  53.     }
  54.     */
  55. </style>
  56. <title>css 드롭다운 메뉴</title>
  57. </head>
  58. <body>
  59. <ul>
  60.     <li></li>
  61.     <li>인사말씀</li>
  62.     <li>포트폴리오
  63.         <ul>
  64.             <li>웹디자인</li>
  65.             <li>웹개발</li>
  66.             <li>수상내역</li>
  67.         </ul>
  68.     </li>
  69.     <li>블로그</li>
  70.     <li>연락처</li>
  71. </ul>
  72. <script>
  73.     $(function(){
  74.         $("ul li").hover(
  75.             function(){
  76.                 $(this).children("ul").css("visibility","visible");
  77.                 $(this).children("ul").slideDown();
  78.             },
  79.             function(){
  80.                 $(this).children("ul").slideUp();
  81.             }
  82.         );
  83.     });
  84. </script>
  85. </body>
  86. </html>
Advertisement
Add Comment
Please, Sign In to add comment