pixelhandler

Pushin' & pullin' pixels on the net

Images Loaded or Not? Check With JavaScript

For sites with a CMS or some easy tool to upload and break images it can be helpful to test if the images are loaded, especially if you have additional behavior for visitors to interact with your images, like a lightbox view.

Javascript function to test if image is loaded already :

Define a CSS class to hide the link with a bad image :

There, no unexpected broken images in view.

Comments