desandro / masonry

:love_hotel: Cascading grid layout plugin
https://masonry.desandro.com
16.45k stars 2.11k forks source link

Replacing Content #84

Closed tylercraft closed 13 years ago

tylercraft commented 13 years ago

i have a grid of photos that are within a div called 'photogrid'. On page load, I am running this code:

$('#photogrid').masonry({ columnWidth: 160, itemSelector: 'div', saveOptions: false },masonryLoaded);

I'd like the user to be able to refresh this grid. I currently have jquery grabbing new content with ajax, removing the 'masoned' class on photogrid, I dump in the new html into #photogrid and I reerun the masonry code. However, it masonry doesn't seem to be running again.

Any ideas or suggestions?

Thanks!

tylercraft commented 13 years ago

Looks like we can close this. Originally the div's only had a float of left (along with the width..etc). This worked initially. However, it wasn't changing the position to absolute on the second go.

Once I set the div to have a position of absolute, it's working great!

desandro commented 13 years ago

A live demo would really help me figure out what's going on. See Guidelines for submitting issues

tylercraft commented 13 years ago

Sorry about that, here is a link to what is happening: http://clients-photoseed.tylerc.net/

Click the refresh in the lower right, and the images fade out, ajax call is made to get new images, masonry is called again.

Once I put a position of absolute on the div's coming in, it works great.