为什么输出宽高为undefined呢
loadImage:function(sourceSrc){
var self=this;
//判断图片是否加载完毕
this.preLoadImage(sourceSrc,function(){
console.log(self.picImage.attr("src"))
self.picImage.attr("src",sourceSrc);
var imageWidth=self.picImage.width(),
imageHeight=self.picImage.height();
console.log(imageWidth+","+imageHeight);
});
},
preLoadImage:function(src,callback){
var img=new Image();
if(!!window.ActiveXObject){
//ie浏览器判断预加载
img.onreadystatechange=function(){
if(this.readyState=="complete"){
callback();
}
};
}
else{
img.onload=function(){
callback();
}
}
img.src=src;
},