Inconsistent image load event firing
Due to some inconsistencies in browser event behaviour, trying to detect when an image has finished loading can be quite difficult. Images that have been retrieved from the user's browser cache sometimes won't fire an onload event at all, making it hard for you to design interfaces that apply styling or anything else dependent on when an image loads.
Use desandro's excellent library
TheĀ desandro/imagesloaded library does an excellent job of fixing this problem: https://github.com/desandro/imagesloaded . It works with vanilla JavaScript or jQuery, so it doesn't introduce any additional dependencies into your project, and properly detects when images have loaded or not (including when an image fails to load).