【发布时间】:2012-10-17 14:13:15
【问题描述】:
我有一个容器#boxes,我需要清空它并使用.imagesLoaded() 添加内容,然后应用砌体。默认情况下,内容包含我删除的砌体项目,然后添加响应中包含的新项目。我的代码的问题是它在我相信的附加之后清空了内容。有什么想法吗?
$(document).ready(function($){
$('div.profile-archive').click(function(){
$("#boxes").empty();
$this = $(this);
var postType = $this.attr("rel");
data = {
action: 'fetch_profile_archive',
postType : postType
};
$.post(ajaxurl, data, function (response) {
var $response = $(response);
$response.imagesLoaded(function() {
$("#boxes").masonry('reload');
}).appendTo("#boxes");
});
});
});
【问题讨论】: