The following, I believe, waits until the image has fully loaded:
$('.some-img').load(function(){
$('.img-container').show();
});
What I want however is to wait until the image has begun to load and adjust the height of the image's container based on the height of the image.
The container's height is responsive height: auto
and the images have varying heights, so the container starts off with no height (just 20px padding) and then quickly adjusts its height based on the height of the image inside it, which is kind of grating each time it loads.
Is there any way to check if the image has started to load so that I can adjust the height of the image's container, then do $('.imagemodal-container').show()
, as waiting for the entire image to load is not good UX.