ajaxの取り込みのための通常のアイソトープの使用が機能しています。 を参照してください。jsfiddleブートストラップアイソトープとlazyloadはjson経由で画像を取り込み/ロードします
アイザクスフェッチによるlazyloadの同位体は機能しません。 問題を参照してくださいjsfiddle。
問題: lazyloadはトリガしないで、グレーのイメージを表示し続けます。 lazyloadセットアップ用
はJavaScript:
$(document).ready(function() {
//
// initialize at ready ;
//
$container.isotope({
itemSelector: '.box',
columnWidth: function (containerWidth) {
return containerWidth/12;
},
onLayout: function() {
$win.trigger("scroll");
}
});
//
// here i will be using data through api
// For now I am defining json manually
// var json is defined at top of this code
// considering json return was success
//$.getJSON(APIURL, function (json) {
var newElements = "";
$.each(json, function (key, value) {
console.log(key);
newElements +=
'<div class="box">' +
'<img class="lazy" src="' + small_img + '" data-originalsrc="' + value['image'] + '" width="' + value['width'] + '" height="' + value['height'] + '" />' +
'</div>';
});
var $newElems = $(newElements);
$container.append($newElems).imagesLoaded(function() {
$container.isotope('appended', $newElems);
$imgs.lazyload({
container: $container,
effect: "fadeIn",
}).removeClass("lazy");
$imgs.trigger('scroll');
});
//});
});
あなたの解決策:) – Misiu