Note that there are some explanatory texts on larger screens.

plurals
  1. PObinding onload event on image object jquery
    primarykey
    data
    text
    <p>Hi I have following code on my site</p> <pre><code> 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"; });; </code></pre> <p>There is large gallery fo 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)..</p> <p>backgroundImages is large array of Image objects, key is the path is the path of image. Every Image obejct has my property "loaded" which says if image has already been loaded, or is currently in state of loading. </p> <p>As you can see from my code I am calling callback function when the image is loaded (there are changes of the background etc.)</p> <p>But I have a problem with I.E&lt;9..the callback is not successfully fired up (but not everytime)..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..</p> <p>I really dont know where could be an error, in all browsers except older IEs it works fine..</p> <p>Actually I need to debug if the event is binded correctly, but I can't see it in both IE and Chrome under load item in debugger:(</p> <p>Please help I am completely screwed, really dont know what to do..</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload