Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6013143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:30:21+00:00 2026-05-23T02:30:21+00:00

Situation: I am resizing / preloading images with javascript before showing them on the

  • 0

Situation:

I am resizing / preloading images with javascript before showing them on the page.

Problem:

ie7 / 8 tend to randomy fire the load event for some images and not for others (this is completely random and different on every refresh)

Code:

JS:

$(document).ready(function(){
$(".daImg").hide();
$("figure").each(function(){
    $(this).append('<div class="loader"><img src="images/ajax-loader.gif"></div>');
    var afb = $(this).find(".daImg");
    afb.load(function(){
    console.log("loaded");          
    $(this).parent().parent().parent().find(".loader").remove();
    if($(this).parent().parent().parent().is(".last")){
        if(afb.height() > 280){
            var w = (afb.width()/afb.height())*280
            afb.css("width",w);
            afb.css("height","280px");
        }
    } else {
        if(afb.height() > 245){
            var w = (afb.width()/afb.height())*245
            afb.css("width",w);
            afb.css("height","245");
        }
    }
    afb.css("left","50%");
    afb.css("margin-left","-"+afb.width()/2+"px");
    afb.fadeIn();
    })
});
}

HTML

 <figure class="left">                      
<a href="foobar.html">
    <div class="imageWrap">
        <img class="daImg"  src="foo-bar.png" alt="foobar" />
    </div>
    <figcaption class="cufonize"><span class="decorated">foobar</span><br> 
        <span class="price">99</span>
    </figcaption>
</a>

<figure class="left">                       
<a href="foobar.html">
    <div class="imageWrap">
        <img class="daImg"  src="foo-bar.png" alt="foobar" />
    </div>
    <figcaption class="cufonize"><span class="decorated">foobar</span><br> 
        <span class="price">99</span>
    </figcaption>
</a>

<figure class="left">                       
<a href="foobar.html">
    <div class="imageWrap">
        <img class="daImg"  src="foo-bar.png" alt="foobar" />
    </div>
    <figcaption class="cufonize"><span class="decorated">foobar</span><br> 
        <span class="price">99</span>
    </figcaption>
</a>

<figure class="left">                       
<a href="foobar.html">
    <div class="imageWrap">
        <img class="daImg"  src="foo-bar.png" alt="foobar" />
    </div>
    <figcaption class="cufonize"><span class="decorated">foobar</span><br> 
        <span class="price">99</span>
    </figcaption>
</a>

<figure class="left">                       
<a href="foobar.html">
    <div class="imageWrap">
        <img class="daImg"  src="foo-bar.png" alt="foobar" />
    </div>
    <figcaption class="cufonize"><span class="decorated">foobar</span><br> 
        <span class="price">99</span>
    </figcaption>
</a>

If anyone could shed some light of what is going on here, I’d appreciate it!

Note: This issue has nothing to do with caching as I am adding time-stamps to all images in my actual code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T02:30:23+00:00Added an answer on May 23, 2026 at 2:30 am

    you may try a different approach in your case

    use css

    .daImg {
       display:none;
    }
    

    then hook your image resizing script on $(window).load();
    and manipulate all images :not(:visible) at once

    you could also duplicate this for the rest browsers to the img.load event but for images that are not already visible. i mean your selector to be var afb = $(this).find(".daImg:not(:visible)");

    in this case IE all images that are not processed by the other event will get processed there

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Situation: you've got a .swf embedded in an html page, and when you click
Here is the situation: I am displaying images on the map by using custom
We have a situation in our project when resizing a container. It seems to
Situation: Google has indexed a page in a forum. The thread is now deleted.
I have a PHP function that I use regularly for working with images (resizing,
Situation: I want to track some Data with Google Analytics on the server-side. Problem:
Situation: need to find which layer the user has touched. Problem: Apple says we
Situation: I create small information divs in the corner of the page. Those are
Situation: I have two dojo autocompleters on a jsp. Both of them trigger the
Situation: I have a simple XML document that contains image information. I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.