Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.19 KB | None | 0 0
  1. <script type="text/javascript">
  2.             var defaultMenubarWidth = 1077;
  3.             var browserWidth;
  4.             var browserHeight;
  5.        
  6.             function debugout( stuff )
  7.             {
  8.                 //document.getElementById('output').innerHTML = document.getElementById('output').innerHTML + stuff + "<br>";
  9.                 document.getElementById('output').innerHTML = 'stuff2';
  10.             }
  11.        
  12.             function layoutMenubar()
  13.             {
  14.                 debugout( "BLA" );
  15.                 var allDivs = document.getElementsByTagName('div');
  16.                 var topItems = new Array();
  17.                 var bottomItems = new Array();
  18.                 var topIndex = 0;
  19.                 var bottomIndex = 0;
  20.                 for( i = 0; i < allDivs.length; i++ )
  21.                {
  22.                    debugout( "searching for top" + topIndex );
  23.                    if( allDivs[ i ].id === ( "top" + topIndex ) )
  24.                    {
  25.                        document.write( "found top" + topIndex);
  26.                        topItems[ topIndex ] = allDivs[ i ];
  27.                        topIndex++;
  28.                    }
  29.                    else if( allDivs[ i ].id === ( "bottom" + bottomIndex ) )
  30.                    {
  31.                        bottomItems[ bottomIndex ] = allDivs[ i ];
  32.                        bottomIndex++;
  33.                    }
  34.                }
  35.                
  36.                layoutMenubarLayer( topItems );
  37.                layoutMenubarLayer( bottomItems );
  38.            }
  39.        
  40.            function layoutMenubarLayer( items )
  41.            {
  42.                for( i = 0; i < items.length; i++ )
  43.                {
  44.                    items.style.width = ( browserWidth / defaultMenubarWidth ) * ( defaultMenubarWidth / items.length ) -
  45.                                        items.style.border-width * items.length;
  46.                }
  47.            }
  48.        
  49.            function getBrowserWidth()
  50.            {
  51.                if( typeof window.innerWidth != 'undefined' )
  52.                {
  53.                    browserWidth = window.innerWidth;
  54.                    browserHeight = window.innerHeight;
  55.                }
  56.                else if( typeof document.documentElement != 'undefined' &&
  57.                        typeof document.documentElement.clientWidth != 'undefined' &&
  58.                        document.documentElement.clientWidth != 0 )
  59.                {
  60.                    browserWidth = document.documentElement.clientWidth;
  61.                    browserHeight = document.documentElement.clientHeight;
  62.                }
  63.                else
  64.                {
  65.                    browserWidth = document.getElementsByTagName('body')[ 0 ].clientWidth;
  66.                    browserHeight = document.getElementsByTagName('body')[ 0 ].clientHeight;
  67.                }
  68.            }
  69.            
  70.            window.onLoad = function()
  71.            {
  72.                debugout( "BLA" );
  73.                getBrowserWidth();
  74.                layoutMenubar();
  75.                body.onResize = function()
  76.                {
  77.                    getBrowserWidth();
  78.                    layoutMenuBar();
  79.                }
  80.            }
  81.        </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement