You can paste the contents and then βreloadβ the masonry. Below is the basic version of what you can do. You will replace the bit that you have, where you connect the contact button with this. You may want to set the flag when adding contact information so that it is not added several times, or give a way to delete contact information (for example, the close button) - it all depends on you.
$(document).ready(function(){ $('#contactlink').click(function(){ var $container = $('#container'); var contactDiv = $('<div class="element">To contact me please call 555-8723</div>'); contactDiv.insertAfter($container.find('.element').eq(3)); $container.masonry('reload'); }); });
source share