首页 > 代码库 > JS Image 加载

JS Image 加载

var imgLoad = function (url, callback) {    var img = new Image();    img.src = url;    if (img.complete) {        callback(img.width, img.height);    } else {        img.onload = function () {            callback(img.width, img.height);            img.onload = null;        };    };};