I have some DIV\'s in my HTML that I load dynamically using AJAX.
$(\"#workPanel\").load(\"ex.html\");
I also have some static links that onclic
You are loading it like:
$('#primary').masonry({
columnWidth: 100,
itemSelector: '.box:not(.invis)',
animate: true,
animationOptions: {
duration: speed,
queue: false
}
});
Ok, so you've defined the masonry options. Now, right after that, let's create a function and bind some events:
var masonryUpdate = function() {
setTimeout(function() {
$('#primary').masonry();
}, 500);
}
$(document).on('click', masonryUpdate);
$(document).ajaxComplete(masonryUpdate);
Never worry about it again!