Advertisement
Guest User

jquery divs

a guest
Jul 20th, 2011
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.73 KB | None | 0 0
  1. <head>
  2.  
  3. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" type="text/javascript"></script>
  4. <script>
  5. $(document).ready(function(){
  6.  
  7. $('a').click(function () {
  8.    var divName = this.name;
  9.     $("#"+divName).fadeIn(1000).siblings().fadeOut(1000);
  10.  
  11. });
  12.  
  13. });
  14. </script>
  15.  
  16. </head>
  17. <body>
  18.  
  19. <!--- BACKGROUND --->
  20. <div id="bck" style="position:absolute; height:900px; width:100%; top:0px; left:0px; background:#000000;"></div>
  21.  
  22. <!--- MENU --->
  23. <div id="menu" style="width:300px; left:0px; top:150px; height:600px; position:absolute;">  
  24. <ul>
  25. <li><a href="#" name="div1" >div1</a></li>
  26. <li><a href="#" name="div2" >div2</a></li>
  27. </ul>
  28. </div>
  29. <div>
  30.  
  31. <!--- DIV1 --->
  32. <div id="div1" style="display:none; position:absolute; height:590px; width:800px; top:150px; left:300px; background:#ffffff; color:#ffffff;">
  33.                     <div id="subdiv1-1" style="position:absolute; left:10px; top:10px; height:280px; width:385px; background:#c1c1c1; color:#000000">
  34.                         testing 123
  35.                     </div>
  36.                     <div id="subdiv1-2" style="position:absolute; left:405px; top:10px; height:280px; width:385px; background:#c1c1c1; color:#000000">
  37.                         testing 123
  38.                     </div>
  39.                     <div id="subdiv1-1" style="position:absolute; left:10px; top:300px; height:280px; width:385px; background:#c1c1c1; color:#000000">
  40.                         testing 123
  41.                     </div>
  42.                     <div id="subdiv1-2" style="position:absolute; left:405px; top:300px; height:280px; width:385px; background:#c1c1c1; color:#000000">
  43.                         testing 123
  44.                     </div>
  45. </div>
  46.  
  47. <!--- DIV2 --->
  48. <div id="div2" style="display:none; position:absolute; height:590px; width:800px; top:150px; left:400px; background:#FFFFFF; color:#000000">
  49.                     <div id="subdiv2-1" style="position:absolute; left:10px; top:10px; height:280px; width:385px; background:#c1c1c1; color:#000000">
  50.                         testing 123
  51.                     </div>
  52.                     <div id="subdiv2-2" style="position:absolute; left:405px; top:10px; height:280px; width:385px; background:#c1c1c1; color:#000000">
  53.                         testing 123
  54.                     </div>
  55.                     <div id="subdiv2-1" style="position:absolute; left:10px; top:300px; height:280px; width:385px; background:#c1c1c1; color:#000000">
  56.                         testing 123
  57.                     </div>
  58.                     <div id="subdiv2-2" style="position:absolute; left:405px; top:300px; height:280px; width:385px; background:#c1c1c1; color:#000000">
  59.                         testing 123
  60.                     </div>
  61. </div>
  62.  
  63. </div>
  64.  
  65. </body>
  66. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement