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

  • SEARCH
  • Home
  • 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 7921723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:41:34+00:00 2026-06-03T16:41:34+00:00

I all, i am making a web site ( http://euroscala.balkanium.com/ ) which has a

  • 0

I all, i am making a web site ( http://euroscala.balkanium.com/ ) which has a menu, and when you click on a menu item, a thumbnail list should appear. I am trying to preload all the images that should appear and then display them. It works fine on every browser except IE (i have version 8). I have put together the code for anyone willing to take a look here: http://jsfiddle.net/THpgM/2/

I think the problem lies in this piece of code (which is near the bottom of the first function in the fiddle)

img.onload = (function(i){ 
  // code here is executed

  return function(){
    // code here is not

    ++totalLoaded;
    document.getElementById("li" + i).style.height = this.height + "px";
    document.getElementById("li" + i).setAttribute("data-height", this.height);

    if(totalLoaded == totalThumbs){
      // do some stuff
    }
  };
})(i);

I have spent like 2 days trying to figure this out. If someone could please help me with this it would be greatly appreciated.

  • 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-06-03T16:41:35+00:00Added an answer on June 3, 2026 at 4:41 pm

    In IE you MUST assign the .onload handler BEFORE you assign .src. If you don’t, then the onload event might fire before your onload handler is in place and you will miss the event.

    // assign .onload before .src
    img.onload = function() {};
    img.src = "xxx.jpg";
    

    The particular issue in IE will happen if the images are in the browser cache (thus they load immediately when .src is assigned) and your onload handler will never execute.

    So, in your jsFiddle, move the assignment to .src to be after the assignment to .onload.

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

Sidebar

Related Questions

I'm making a theme that has inline CSS as a first website at http://flexibilitytheme.tumblr.com/
I am making a tabbed navigation menu via jQuery in my website. All the
I have searched all over the web with no luck of making this project
I'm making a script to open all links on a page when I click
I'm making a script to list all files within a folder. The intention is
I'm making an ExtendScript script which goes through all the fonts used in an
I am making one application in which I want to browse all the albums
I'making website which is for all desktop/iPad/iPhone. In one page I have header and
I'm making an html5 website. the page I'm encountering the issue is http://yamikowebs.com/blog.php right
I set a magento website with several stores, I'm making a list of all

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.