ponysmith.github.io

imginCallbacks

The example below uses the onload callback function to add a loaded message to the image containers.

Since the callback function passes a jQuery reference to the loaded image, you can do anything you would normally do in jQuery. However, be aware that some operations (like editing styles) might be more efficient to do in CSS via the data-imginloaded attribute. See the CSS section on the documentation page.

Example

Code for this example

1
2
3
4
5
6
7
// Set a callback function to add a message
var opts = {
	onload: function(img) {
		img.parent().append('<div class="onload">Loaded!</div>');
	}
}
imgin(opts);