preloadImage: function(index, callback) {
if(this.images[index]) {
var image = this.images[index];
if(!this.images[index].preloaded) {
var img = $(new Image());
img.attr('src', image.image);
if(!this.isImageLoaded(img[0])) {
this.preloads.append(img);
var context = this;
img.load(
function() {
image.preloaded = true;
image.size = { width: this.width, height: this.height };
context.fireCallback(callback);
}
).error(
function() {
image.error = true;
image.preloaded = false;
image.size = false;
}
);
} else {
image.preloaded = true;
image.size = { width: img[0].width, height: img[0].height };
this.fireCallback(callback);
};
} else {
this.fireCallback(callback);
};
};
},
请问一下,我用jquery ad_gallery 插件时,图片加载时,出现小图片,界面刷新一下就正常了,是否是img.load有问题,有时候加载的图片正常,有时候就变成小图了?
if(this.images[index]) {
var image = this.images[index];
if(!this.images[index].preloaded) {
var img = $(new Image());
img.attr('src', image.image);
if(!this.isImageLoaded(img[0])) {
this.preloads.append(img);
var context = this;
img.load(
function() {
image.preloaded = true;
image.size = { width: this.width, height: this.height };
context.fireCallback(callback);
}
).error(
function() {
image.error = true;
image.preloaded = false;
image.size = false;
}
);
} else {
image.preloaded = true;
image.size = { width: img[0].width, height: img[0].height };
this.fireCallback(callback);
};
} else {
this.fireCallback(callback);
};
};
},
请问一下,我用jquery ad_gallery 插件时,图片加载时,出现小图片,界面刷新一下就正常了,是否是img.load有问题,有时候加载的图片正常,有时候就变成小图了?
路过,这个插件刚还没用过。
jQuery的插件太多了。