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 6136705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:38:07+00:00 2026-05-23T17:38:07+00:00

I have following code on my site: backgroundImages[bg_img_path_b]=new Image(); backgroundImages[bg_img_path_b].src = bg_img_path_b; backgroundImages[bg_img_path_b].loaded=loading; //jQuery(backgroundImages[lastImage]).unbind(‘load.backgroundImages’);

  • 0

I have following code on my site:

 backgroundImages[bg_img_path_b]=new Image();
 backgroundImages[bg_img_path_b].src =     bg_img_path_b;
 backgroundImages[bg_img_path_b].loaded="loading";
 //jQuery(backgroundImages[lastImage]).unbind('load.backgroundImages');                                         

 jQuery(backgroundImages[bg_img_path_b]).bind('load.backgroundImages',function(){
      if(typeof callback=='function'){
           callback.call(this, bg_img_path_b);
           if(showLoading) hideLoadingDC();
      }
 }).bind('load.cache', function(){
                            backgroundImages[bg_img_path_b].loaded="true";
                        });;

There is large gallery for images used as background-images of page wrapper. I need to preload images because of speed (the images are quite large). So I have this code (actually is only a part of bigger function, which wraps caching and so on, but this few lines are fired when image is not in cache).

backgroundImages is large array of Image objects, key is the path is the path of image. Every Image object has my property “loaded” which says if image has already been loaded, or is currently in state of loading.

As you can see from my code I am calling callback function when the image is loaded (there are changes of the background etc.)

But I have a problem with I.E<9, the callback is not successfully fired up (but not every time)..When I load my page for first it loads properly, but anytime I call this function again, it goes correctly through without errors, but the load event doesn’t fired..

I really don’t know where could be an error, in all browsers except older IEs it works fine..

Actually I need to debug if the event is bound correctly, but I can’t see it in both IE and Chrome under load item in debugger:(

Please help I am completely screwed, really don’t know what to do.

  • 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-23T17:38:08+00:00Added an answer on May 23, 2026 at 5:38 pm

    So few days ago I finally found out a solution to my problem..It seems its matter if I at first bind the onload event and then set the url of Image, or at first set the url and then bind the event..
    Example

    var photo = new Image();
    photo.url = "http://www.something.com/something.jpg";
    $(photo).bind('load',doSomething());
    
    
    var photo = new Image();
    $(photo).bind('load',doSomething());
    photo.url = "http://www.something.com/something.jpg";
    

    First variant runs usually ok, but sometimes it fails (in older IEs)..But the second variant is sure working propely..

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

Sidebar

Related Questions

On my web site, I have the following code: <input type=image src=images/btn.png alt=Submit border=0
I have the following code snippet: using (SPSite site = new SPSite(this.ListAddress)) { using
I have following code for loading image from url in xml parsing endElement method
I have the following code, written using jQuery: var strval = '22' $(#quicknote).attr(href, javascript:location.href=/'http://site.com/notes/add?projects=/'+
I have the following jQuery code on a site I built: $(document).ready(function() { //
I have the following code in an ASP.NET site using (MailMessage mailMessage = new
I'm using the datepicker form jQuery-ui-1.8.16. I have the following code: Site.Calendar = function()
I have the following code, deployed on a https Asp site, build with MVC
From this site: http://www.toymaker.info/Games/html/vertex_shaders.html We have the following code snippet: // transformations provided by
I am working on a WordPress site and I have placed the following code

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.