Retrigger $().load event in jQuery -


When I want to do something when an image is loaded I

$ ("# image") .load (function () {some});

  • But something other than Firefox only loads the image for the first time, for example, if I have created a gallery of images and want to do something, when an image is full, So i I use it and it works for the first time: but if the user manipulates the image (which is already in the cache), the event does not trigger IE etc. in Opera.

One way to fix this is to add some random number to the image source, but it takes additional bandwidth because it needs to download the image again (correct?).

Is there a good solution for this?

check the use of .complete:

  $ ("# Image "). Each (function () (if (this.complete) doSomething (); // Instantly runs, image ready (cache) other $ (this) .load (function () {doSomething ();}) // // loading Will run on}};  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -