Here is a little sample: http://cdpn.io/Gpdyx
It contains a PictireFill script from:
https://github.com/scottjehl/picturefill
and small jQuery code that tries to set same height of .copy
element as the image height.
The problem is when PictureFill comes into a play - image is obviously not loaded when jQuery fires document ready script - so it can't set correct .copy
height. But when you resize the browser - everything works fine as the image is already there.
How could I detect an action when the image is loaded by PictureFill and fire my resizeAction function so everything works smoothly as it should?
Ps. The codepen is simplified to the maximum. PicruteFill might have multiple images as an arguments (different sizes for different browser widths etc), and there might be multiple sections working as the example - so the solution should be universal.
Edit2: As suggested I have used imagesLoaded - and it almost works... except on firefox on the first time image is loaded it doesn't fire correctly. On Chrome everything works fine. Any suggestions?