terrymun/Fluidbox — pull request #46 by hybernaut (2014-04-20 19:15:10+00:00)
Title: Incremental instead of waiting for all imagesLoaded

I have pages with a large number of images, and it was disorienting to wait for all images to fully load before applying the Fluidbox behavior. Especially since the standard HTML structure is an A tag referencing the larger image; this results in early click behavior replacing the current page with the larger image.

So instead I removed the imagesLoaded dependency, and bound a load() behavior to each image selected for Fluidbox. In some cases the image is already loaded before we reach this code, so we check for nonzero image height and width. If this is the case we immediately apply the Fluidbox behavior; if not we defer it using jQuery load(). Now the behavior is applied to each image immediately after loading, or for images already in cache, at document ready time.