Примеры для jQuery .load()


Run a function when the page is fully loaded including graphics.

1
2
3
$( window ).load(function() {
// Run code
});

Add the class bigImg to all images with height greater than 100 upon each image load.

1
2
3
4
5
$( "img.userIcon" ).load(function() {
if ( $( this ).height() > 100) {
$( this ).addClass( "bigImg" );
}
});