【发布时间】:2011-07-22 17:42:00
【问题描述】:
我已经阅读了 jQuery 的加载方法不触发缓存图像的各种解决方法(重置 src,使用 .complete)。但是我在以下live 事件中实际实施它们时遇到了麻烦。缓存的图像仍然无法加载。
$('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);
});
感谢您的任何建议!
【问题讨论】:
标签: jquery image load live caching