Guest User

Untitled

a guest
Apr 21st, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. <div style="position:relative;">
  2. <div style="position:absolute; z-index:1000;">FOO</div>
  3. </div>
  4. <div style="position:relative;">
  5. <div style="position:absolute; z-index:1;">BAR</div>
  6. </div>
  7.  
  8. <div style="position:relative; z-index:2;">
  9. <div style="position:absolute; z-index:1000;">FOO</div>
  10. </div>
  11. <div style="position:relative; z-index:1">
  12. <div style="position:absolute; z-index:1;">BAR</div>
  13. </div>
  14.  
  15. <div style="position:relative;">
  16. <div style="position:absolute; z-index:1;">BAR</div>
  17. </div>
  18. <div style="position:relative;">
  19. <div style="position:absolute; z-index:1000;">FOO</div>
  20. </div>
  21.  
  22. <body>
  23. <div style="position:relative; z-index:2;">
  24. OUTERFOO
  25. <div style="position:absolute; z-index:1000; background:red;">
  26. FOO
  27. </div>
  28. </div>
  29. <div style="position:relative; z-index:1">
  30. OUTERBAR
  31. <div id="bar" style="position:absolute; top:-30px; z-index:1; background:green;">
  32. BAR
  33. </div>
  34. </div>
  35. <button onclick="moveThisCrapForIE7();">Test</button>
  36. <script type="text/javascript" language="javascript">
  37. // Probably best to kick this off when your body is totally loaded.
  38. // jQuery's $(document).ready is really good for that.
  39. // for now I'm just using a button to test.
  40. function moveThisCrapForIE7() {
  41. // You'll need something more reliable for browser detection here, this will only get IE7 not IE6.
  42. // I'd recommend jQuery for everything really. It'll save you miles of code.
  43. if(navigator.appVersion.indexOf('MSIE 7') > -1) {
  44. // Get your element and move it to where you want it.
  45. var bar = document.getElementById('bar');
  46. document.body.appendChild(bar);
  47. //Then you'll need to monkey with the location
  48. // to make sure it's where you want it.
  49. bar.style.top = '15px';
  50. bar.style.left = '90px';
  51. bar.style.zIndex = '3';
  52. }
  53. }
  54. </script>
  55. </body>
Add Comment
Please, Sign In to add comment