I have a bunch of images which is on a page that is injected into another page using AJAX.
When the images are injected I want to run through them, set the shortest side to 64px and then clip the image to 64x64 pixels (have the 'viewport' in the top middle).
I have a method which iterates over all images and do the logic as it should. But it seems to run before the images get their correct size. I get that it's because the browser doesn't resize until the DOM is loaded.
I have tried a bunch of stuff like using load() and creating images in memory (is this really size to do for each images? feels bad performance-wise).
You can use simple Ajax start and ajax complete function. An example given below:
$(document).ajaxStart -> $("#accordion2").css "opacity", "0.4" return $(document).ajaxComplete -> $("#accordion2").css "opacity", "1.0" #You can call your Image Load function here return