我在使用.show("blind",1000)
插入图片时遇到问题 - 我正在使用websockets快速连续添加它们。它们在大多数情况下都会加载,但有时图像会加载“盲”效果,然后隐藏,然后重新加载。
我认为这是因为li:first
选择器,而且有些图像没有按顺序处理(因为它们有时会比图像加载的速度快到达)。
jQuery的:
function message(msg){
if (msg.toLowerCase().indexOf("col=\"image\"") >= 0) {
$('#images').prepend(msg);
$('#images').find('li:first').hide();
$("#images").find('img').load(function(){
$(this).closest("li").show("blind", 1000);
console.log($(this));
});
}
}
HTML:
<!-- (msg) = -->
<div col="image" class="ibox tile">
<li><img src="%smedia/?size=m" width="200px">%s
<div class="username">by %s</div></li>
</div>' <!-- python: % (url, text, name) -->
)
如何使用“盲”效果加载图像 - 一次 - 没有这个加载 - 两次“错误”?