Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialryan champin
16,836 Pointsajax and plugins
So im importing images from dribbble with ajax.....i have the content loading fine. Im trying to add a button to load more images on click....my code for that loads the images correctly...but im also using masonry for the image layout style. My question is if my page first loads....applies the masonry styles and JS effects to the automatically loaded first set of images. Now when i click the load more button it loads the images but they completely break my layout...its as if masonry isnt applying the JS to the newly loaded items....
2 Answers
Kevin Korte
28,149 PointsYou're going to reload masonry with the new items. It won't do that automatically. Masonry runs once with what's on the page and that's it. You'll probably have to reload masonry with your ajax callback to get it to work.
There are some stack overflow threads in this google search that might help https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=masonry%20and%20ajax
ryan champin
16,836 Pointsgreat thanks thats what i thought