困擾很久的問題
想不到換個順序就解決了
http://www.thefutureoftheweb.com/blog/image-onload-isnt-being-called
// evil:
var image = new Image();
image.src = 'image.jpg';
image.onload = function() {
// sometimes called
alert('image loaded');
};
// good:
var image = new Image();
image.onload = function() {
// always called
alert('image loaded');
};
image.src = 'image.jpg';
沒有留言:
張貼留言