Skip to content Skip to sidebar Skip to footer

How To Use Jquery To Detect Loaded Background Image After Inserting Out Css

I had googled for a long time to find out the solution but failed in the end. Here comes my detail problems below: I have a javascript code written with jQuery lib. $('

Solution 1:

No example code, but the best I can suggest is to extract the full url in parentheses, then create an image object, set the source to that url, and then bind whatever you action you want to the onload for that image. I'm not 100% it will work, but I believe that the image will only be downloaded once for both the background and your new image object, firing the event at the correct time.

You may need to also use the event.special.load plugin in case the image in the background gets downloaded before the image object is created. Because if that happens, it'll be coming from the cache which the onload event may or may not handle correctly.

Post a Comment for "How To Use Jquery To Detect Loaded Background Image After Inserting Out Css"