div overlap

div overlap

Hi guys,

I have the follow page:

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.   <script src="http://code.jquery.com/jquery-latest.js"></script>
  5. </head>
  6. <body>
  7. <div id="id1">
  8.     <a href="#" id="button">Click</a>
  9.     <div id="id1intern" style="display:none">
  10.         <a href="#"><img name="test" id="test" src="test.jpg" alt="test"/></a>
  11.     </div>
  12. </div>
  13. <div id="id2" style="position:absolute">
  14.     <a href="#"><img name="test2" id="test2" src="test.gif" alt="test"/></a>
  15. </div>
  16. </body>
  17.   <script type="text/javascript">
  18.     $(function(){
  19.         $('#button').click(function(){
  20.             $('#id2').css('z-index', '1');
  21.             $('#id1').css('z-index', '2');
  22.             $('#id1intern').css('z-index', '3');
  23.             $('#id1intern').slideToggle('medium');
  24.         });
  25.     });
  26.   </script>
  27. </html>
I'm trying to show #id1intern (previously hidden) and make it overlap #id2. My tests have shown that #id2 is moved to the bottom. I have tried to apply the "z-index" property to the divs, but I couldn't get to work. Anyone got a tip if this is possible and how to make this work?
Thanks in advance.