Results 1 to 5 of 5

Thread: Frame Resize

  1. #1
    Join Date
    Jul 2006
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Frame Resize

    How can dynamically resize a frame when the mouse passes over it?

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    That could get really complicated depending upon just what you mean but, a simple answer is to give the iframe a mouseover event that changes its width and/or height attribute values. Ex:

    Code:
    <iframe id="theFrame" src="iframe_over_ex.htm" width="350" height="500" scrolling="auto" frameborder="0" onmouseover="this.width=550;"></iframe>
    That will work in IE and FF but for Opera, you also need something like so on the page showing through the iframe:

    Code:
    <body onmouseover="parent.document.getElementById('theFrame').onmouseover();">
    either added to the body tag as shown above or as a part of a script on or linked to the page. If it is used as a part of a script, the syntax would be different.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    And the latter code won't work across multiple domains.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by Twey
    And the latter code won't work across multiple domains.
    True, very little javascript works across domains - parent window to child window and visa versa.

    Probably if you had a division around the iframe with some padding, you could work it out so that Opera wouldn't need any extra code on the content page but, it would require some extra code associated in some way with this container division of the iframe.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    In fact, if you were willing to give the iframe itself some fairly hefty padding, it could work in Opera without any code on the content page.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •