0
일부 DIV를 정렬하기 위해 jQuery 플러그인 "Masonry"(http://masonry.desandro.com/)를 사용하고 있습니다. 이러한 DIV는 AJAX로로드되며 플러그인이 너무 일찍 시작되어 위치가 잘못되었습니다. 어떻게 이러한 기능에 적절한 지연을 설정할 수 있습니까?jQuery Masonry with AJAX 사용
function loadALLtheposts(id) {
$.ajax({
url: "******.php",
data: {userID: id},
type: "POST",
dataType: "text",
contentType: "application/x-www-form-urlencoded; charset=utf-8",
success: function (data) {
$('#timeline-posts').html(data);
masonry_index();
}
});
}
function masonry_index() {
$('#timeline-posts').masonry({
itemSelector : '.post-wrapper',
columnWidth : 266
});
}
감사합니다. DOMSubtreeModified (사용되지 않음)
$("#timeline-posts").bind("DOMSubtreeModified", function() {
masonry_index(); //this is called only after the #timeline-posts changes.
$(this).unbind('DOMSubtreeModified'); //if required do this
});
사용 MutationObservers 대신 -