Results 1 to 4 of 4

Thread: Removing the image frame that appears before the image is loaded (Firefox)

  1. #1
    Join Date
    Jan 2011
    Posts
    6
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Removing the image frame that appears before the image is loaded (Firefox)

    Hi,

    Is there a way to remove (or get around) the empty image frame that appears when the actual image is loading? You can see the example here:
    http://dl.dropbox.com/u/13341502/imgBox.jpg

    It seems to only happen in Firefox. And I prefer the way browsers like Safari load the images, just plain blank without any frames or icons.

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    You can try putting this in the <head> part of your document, replacing the image1 and image2 with your images (and adding more as needed):
    Code:
    <script type="text/javascript">
    var preload = ['image1', 'image2'];
    var loadedImg = new Array();
    for(var i = 0; i <= preload.length-1; i++){
         loadedImg[i] = new Image();
         loadedImg[i].src = preload[i];
    }
    </script>
    Jeremy | jfein.net

  3. #3
    Join Date
    Jan 2011
    Posts
    6
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Nile,

    It might be ok to preload if I only have a few images, but the problem is I have hundreds. And a part of my website is a wordpress blog. So I don't think it might be suitable...

  4. #4
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Okay. Instead of actually getting rid of the boxes, you can just display a "loading" sign at the top of your document.

    Place this in the <head> part of your document
    Code:
    window.onload = function(){
        document.getElementById('loading').style.display = "none";
    }
    And make a div with an id of loading where ever you want it

    Code:
    <div id="loading"><span>Loading... Please wait.</span></div>
    Jeremy | jfein.net

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
  •