On Browser Zoom -in/out

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • romepatel
    New Member
    • Nov 2009
    • 31

    On Browser Zoom -in/out

    Hi,

    I want to set the table width and height to the screen width and height of the browser,
    so that the page is fixed the screen size.
    For now i am assigning the width and height on the page load by JavaScript.
    But when the user Zoom -in/out the table width and height doesn't change.
    If i refresh the page, then it is working fine, but i want to change the width as the user zoom-in/out his browser.

    I want to re-assign the screen size to the table when the user zoom in/out his browser.

    Code:
     <script type="text/javascript">
    	var myWidth = 0, myHeight = 0;
      if( typeof( window.innerWidth ) == 'number' ) {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
      } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
      } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
      }
    
    document.getElementById('table_id').style.width= eval(myWidth - 10) + 'px';
    document.getElementById('table_id').style.height= eval(myHeight - 10) + 'px';
     </script>
    Please Help Me Out.......!!!
    Thanks in Advance........ !!!
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    i'm not aware of an event that is firing when the page zoom is triggered ... it might be that the resize-event is fired? ... another approach is here ...

    kind regards

    Comment

    Working...