The masonry call is again in the attenuation callback. Make it easy on yourself and do your masonry initialization in a function. Define your parameters there so that you do not have to transfer parameters to the callback area.
In this way
$(function(){ var $bricks = $('your > elements'); function BuildWall(){ $bricks.masonry({your:'options'}); } BuildWall(); //Your code modified if($deletes = $('a[rel=delete]')) { $deletes.click(function() { if(!window.confirm('Are you sure you wish to delete this picture?')) return false; var $t = $(this); $.post( $t.attr('href'), {}, function(data) { if(data == "success") $t.parents('.deleteable:first').fadeOut(function(){ //This is faster than $(this).remove(); $(this).empty().remove(); //Reset Masonry BuildWall(); }); } ); return false; }); } });
source share