Black Fade Background Not Working

Discussion in 'JavaScript' started by Pudge1, Sep 27, 2011.

  1. #1
    function grayOut(vis, options) {
      var options = options || {};
      var zindex = options.zindex || 50;
      var opacity = options.opacity || 70;
      var opaque = (opacity / 100);
      var bgcolor = options.bgcolor || '#000000';
      var dark=document.getElementById('darkenScreenObject');
      if (!dark) {
        var tbody = document.getElementsByTagName("body")[0];
        var tnode = document.createElement('div');
            tnode.style.position='absolute';
            tnode.style.top='0px';
            tnode.style.left='0px';
            tnode.style.overflow='hidden';
            tnode.style.display='none';
            tnode.id='darkenScreenObject';
        tbody.appendChild(tnode);
        dark=document.getElementById('darkenScreenObject');
      }
      if (vis) {
        if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
            var pageWidth = document.body.scrollWidth+'px';
            var pageHeight = document.body.scrollHeight+'px';
        } else if( document.body.offsetWidth ) {
          var pageWidth = document.body.offsetWidth+'px';
          var pageHeight = document.body.offsetHeight+'px';
        } else {
           var pageWidth='100%';
           var pageHeight='100%';
        }
        dark.style.opacity=opaque;
        dark.style.MozOpacity=opaque;
        dark.style.filter='alpha(opacity='+opacity+')';
        dark.style.zIndex=zindex;
        dark.style.backgroundColor=bgcolor;
        dark.style.width= pageWidth;
        dark.style.height= pageHeight;
        dark.style.display='block';
      } else {
         dark.style.display='none';
      }
    }
    
    Code (markup):
    http://007vg.com/n64/goldeneye/walkthrough

    If you select one of the videos you can see what I'm talking about. The black background should stretch all the way to the bottom of the page but for some reason it stops short. I can't figure out why it is doing this either. Any ideas?
     
    Solved! View solution.
    Pudge1, Sep 27, 2011 IP
  2. #2
    you are executing the viewVid function before the footer-container div, try to execute it after the div or maybe before </body>
     
    JohnnySchultz, Sep 28, 2011 IP