Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Jun 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    dynamic image resize problem

    I'm trying to do several things with an image on my page.

    1) it is in an iframe
    2) it resizes dynamically when the parent page does
    3) it randomly selects the image with a php script

    the image is used as a background in the iframe and so should take up 100% of the space inside it. I had problems trying to resize a background image and so it's a z-indexed image instead. The problem is that the image shows up very small in the top left corner until the window is resized, then it resizes perfectly as it should. I used different scripts and snippets that I found on the web so it's hacked together and kinda strange probably, but heres the relevant code I think. Please tell me if you know why the image is misbehaving.

    http://sharadon.l4rge.com (my page)

    http://www.boutell.com/newfaq/creati...roundfill.html (script for resizing the background image)

    The code for finding the window size
    [CODE]
    function GetWidth()
    {
    var x = 0;
    if (self.innerHeight) { x = self.innerWidth; }
    else if (document.documentElement && document.documentElement.clientHeight) { x = document.documentElement.clientWidth; }
    else if (document.body) { x = document.body.clientWidth; }
    return x;
    }

    function GetHeight()
    {
    var y = 0;
    if (self.innerHeight) { y = self.innerHeight; }
    else if (document.documentElement && document.documentElement.clientHeight) { y = document.documentElement.clientHeight; }
    else if (document.body) { y = document.body.clientHeight; }
    return y;
    }

    function changeWidth() {
    var i = GetWidth()-195;
    document.getElementById("main_pane").width=i;
    }

    function changeHeight() {
    var i = GetHeight()-161;
    document.getElementById("main_pane").height=i;
    }
    [CODE]

    and finally the php random background script is at http://www.marcofolio.net/webdesign/php_random_image_rotation.html

    It's driving me nuts that stupid little image :P
    Last edited by Kindredlord; 06-20-2009 at 08:26 AM.


 

Tags for this Thread

Posting Permissions

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