我读过jQuery的加载方法不缓存的图像(重置src,使用.complete)的各种解决方法。但是我在实际执行下列live
事件时遇到问题。缓存的图像仍然无法加载。在jquery活动事件处理程序中加载缓存的图像?
$('img.img-thumbs').live('click', function() {
$('#loader').fadeOut(500, function() {
$(this).empty();
$(this).removeClass().addClass("loading visible");
$(this).fadeIn(500);
});
var url = ($(this).attr('src')).replace("thumbs", "content");
var _img = new Image();
$(_img).one("load", function() {
$('#loader').fadeOut(500, function() {
$(this).removeClass().addClass("loaded visible fadeMe").append($(_img));
$(this).fadeIn(500);
});
}).attr('src', url);
});
感谢您的任何建议!