0
我正在使用jQuery插件“Masonry”(http://masonry.desandro.com/)对一些DIV进行排序。这些DIV加载了AJAX,并且不知何故,插件启动得太早,导致位置错误。 如何在这些功能中设置适当的延迟?使用AJAX的jQuery砌体
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
});
}
在此先感谢您。