onload 好像不行。
1
qq641016547 2018-04-26 19:18:54 +08:00 via iPhone
|
2
qq641016547 2018-04-26 19:21:58 +08:00 via iPhone
图片糊了...
function imgLoad(url, callback){ var image = new Image(); image.src = url; if(image.readyState){ image.onreadystatechange = function(){ if(image.readyState === 'loaded' || image.readyState === 'complete'){ image.onreadystatechange = null; callback(image.width,image.height); } }; }else{ image.onload = function(){ if(image.complete){ callback(image.width,image.height); } }; } } |