$( 'img' ).load( function(){ ... });
– 信頼できるものではありません (プラグインにこのコードが表示されます)。ここで理由がわかります:
http://api.jquery.com/load-event/caveats
(言葉から読み始めてください)
問題を説明するための小さな例を次に示します。
$( document ).ready( function(){
$( 'img' ).load( function(){
// this event going to fire only if document was ready after image was loaded; (very seldom, almost never)
console.log( 'Fired?! You are lucky today!' );
});
$( document.body ).append( '<img src="http://stat19.privet.ru/lr/0b164d8151948d2fdedfbfdc420f5392?temp=2" id="some"/>' );
$( '#some' ).load( function(){
// this event will fire often, except of cases descripted in `load` event manual
console.log( 'Huugh. Today have fired. But I don\'t know about tomorrow' );
});
var temp = new Image;
temp.src = 'http://photo.a42.ru/photos/92772/medium/11757.jpg';
temp.onload = function(){
// this event going to fire almost always except of cache issue with IE, that can be handled by skipping cache with `?nothing=random` appending to image URL
console.log( 'Okay, okay! I\'ve fired' );
}
$( document.body ).append( temp );
});
ここで実行できます: http://jsfiddle.net/p6Cpy/