图片加载完后执行事件
var count=0;
$append_items.find('img').on('load',function(){
count++;
if(count == $append_items.length){
$masonry_box.append($append_items).masonry('appended',$append_items);
}
});
解决因为图片缓存导致不load的问题
_imgbox.find('img').each(function(){
var _this_js=$(this).get(0);
if(_this_js.complete) {
count++;
if(count == _imgbox.find('img').length){
_imgbox.find('img').each(function(){
imsh+=$(this).outerWidth(true);
})
_imgbox.attr('data-height',imsh);
}
}else{
$(this).one('load',function(){
count++;
if(count == _imgbox.find('img').length){
_imgbox.find('img').each(function(){
imsh+=$(this).outerWidth(true);
})
_imgbox.attr('data-height',imsh);
}
})
}
});

浙公网安备 33010602011771号