asimryu

left-menu with jquery animate sample 1

May 22nd, 2014
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.47 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>lenft menu</title>
  6. <style>
  7.     #menu { width:200px;  }
  8.     #menu ul { padding:0; list-style:none; }
  9.     #menu ul li { width:200px; height:30px; overflow:hidden;}
  10.     #menu ul li:hover { border-bottom:2px solid #369;}
  11.     #menu ul li div { float:left; height:30px;line-height:30px; }
  12.     #menu ul li div.menutext { width:150px; }
  13.     #menu ul li div.arrow { display:none; width:20px; color:#f00; }
  14. </style>
  15. <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
  16. </head>
  17. <body>
  18.     <div id="menu">
  19.         <ul>
  20.             <li>
  21.                 <div class="menutext">MENU - 1</div>
  22.                 <div class="arrow"></div>               
  23.             </li>
  24.             <li>
  25.                 <div class="menutext">MENU - 2</div>
  26.                 <div class="arrow"></div>               
  27.             </li>
  28.             <li>
  29.                 <div class="menutext">MENU - 3</div>
  30.                 <div class="arrow"></div>               
  31.             </li>
  32.             <li>
  33.                 <div class="menutext">MENU - 4</div>
  34.                 <div class="arrow"></div>               
  35.             </li>
  36.         </ul>
  37.     </div>
  38.     <script>
  39.         $("#menu ul li").hover(
  40.             function(){
  41.                 $(this).animate({paddingLeft:10});
  42.                 $(this).children(".menutext").animate({marginLeft:"10px"});
  43.                 $(this).children(".arrow").show();
  44.             },
  45.             function(){
  46.                 $(this).children(".menutext").animate({marginLeft:"0"});
  47.                 $(this).children(".arrow").hide();
  48.             }
  49.         );
  50.     </script>
  51. </body>
  52. </html>
Advertisement
Add Comment
Please, Sign In to add comment