Your Ad Here

Posted By

krisdb on 04/13/07


Tagged

other


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

vali29


overlay


 / Published in: Other
 

  1. #overlay {
  2. visibility: hidden;
  3. position: absolute;
  4. left: 0px;
  5. top: 0px;
  6. text-align:center;
  7. z-index: 1000;
  8. background-image:url(/images/overlay.gif);
  9. }
  10.  
  11. #overlay div {
  12. width:300px;
  13. margin: 100px auto;
  14. background-color: #fff;
  15. border:1px solid #000;
  16. padding:15px;
  17. text-align:center;
  18. }
  19.  
  20. function toggleDisplay(DomObject) {
  21.  
  22. if (DomObject.style.visibility) {
  23. DomObject.style.visibility = (DomObject.style.visibility == 'visible') ? 'hidden' : 'visible';
  24. }
  25. else {
  26. DomObject.style.display = (DomObject.style.display == 'block') ? 'none' : 'block';
  27. }
  28. }
  29.  
  30. function overlay() {
  31. var DomObject = document.getElementById('overlay');
  32. setOverlayDim(DomObject);
  33. toggleDisplay(DomObject);
  34.  
  35. setTimeout('toggleDisplay(\'overlay\')',5000);
  36. }
  37.  
  38. //set the height and width dimensions for the fullscreen overlay layer
  39. function setOverlayDim(DomObject) {
  40. var x;
  41. var y;
  42.  
  43. // all except Explorer
  44. if (self.innerHeight) {
  45. x = self.innerWidth;
  46. y = self.innerHeight;
  47. }
  48. // Explorer 6 Strict Mode
  49. else if (document.documentElement && document.documentElement.clientHeight) {
  50. x = document.documentElement.clientWidth;
  51. y = document.documentElement.clientHeight;
  52. }
  53. // other Explorers
  54. else if (document.body) {
  55. x = document.body.clientWidth;
  56. y = document.body.clientHeight;
  57. }
  58.  
  59. DomObject.style.width = x.toString() + 'px';
  60. DomObject.style.height = y.toString() + 'px';
  61. }
  62.  
  63.  
  64. <div id="overlay" style="visibility:hidden;">
  65. <div id="overlayContent">
  66.  
  67. <a href="#" onclick="overlay();" style="color:#000;">Close</a>
  68.  
  69. </div>
  70. </div>
  71.  
  72. <input type="button" value="" onclick="overlay();" />

Report this snippet  

You need to login to post a comment.