I am loading images via jQuery's ajax function, and I have to measure the dimensions of the image, to then realign the divs and such once they have loaded, the problem is that if the image isn't fully loaded then it can't get the dimensions of the image, but the event has already fired, so the image is aligned horribly wrong. I have tried a couple of different jQuery plugins, and they partially work, but not entirely, none of them seem to fully wait for the image to load, the width is successfully retrieved, and it is all aligned horizontally fine, however vertically it doesn't.
Asked
Active
Viewed 253 times
1
-
Does this help: http://stackoverflow.com/a/9589845/941536 ? – kendaleiv Oct 06 '12 at 04:48
-
Well, actually that is the one I have been using now, and actually, my problem may have been unrelated to that, I had a problem with my algorithm that was returning the wrong values under a certain circumstance, so I've taken care of that now and it works. – Dylan Cross Oct 06 '12 at 04:56
1 Answers
2
I am not sure what you are trying to achieve but if aligning the images vertically is what you want, have you checked the jQuery Masonry plugin ? It can align the divs/images dynamically and has a imagesLoaded
method which works pretty well in my experience

Madhur
- 2,119
- 1
- 24
- 31