Results 1 to 4 of 4

Thread: Capturing resize events

  1. #1
    Join Date
    Aug 2006
    Posts
    239
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Capturing resize events

    How can I detect that browser window is being resized, other than continous loop of checking its dimensions?

    I tried window.onresize = runme(), document.onresize = runme(), document.body.onresize = runme() and while it doesn't generate errors, the called function doesn't fire up...

    any ideas?

  2. #2
    Join Date
    Sep 2006
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    you probably want to go with an event based function that checks only when your window is resized.

    If you have programmed with DOM before, you want use event handlers and listeners to set this up.

    You could use DOM level 0 event with onResize()

    http://www.w3schools.com/htmldom/dom_obj_document.asp

  3. #3
    Join Date
    Aug 2006
    Posts
    239
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    http://rambo.id.uw.edu.pl/pic.php,Cr...jpg,viewer,0,0
    hmmm, let's call it: accidental feature- resize browser window...
    and then move the "inner" window...

  4. #4
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by ItsMeOnly
    I tried window.onresize = runme() ...
    Unless the runme function returns a function object which is the real listener, lose the parentheses:

    Code:
    window.onresize = runme;
    In your post, the runme function would be called when that expression statement is evaluated, and the return value of that function would be assigned to the property and used as the event listener.

    Mike

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •