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 trial

JavaScript

I could you some help with my AJAX Masonry Gallery project.

I really liked AJAX basics course (https://teamtreehouse.com/library/ajax-basics) so I decided to do simple project. I used Masonry js plugin along with ImagesLoaded. As you can see (link to codepen.io at the end of topic) it loads latest flickr images and then it can load images tagged as "sea" or "lake". Sorting script is not that simple as it was in course because my original project uses private api key and I don't want to share it so I simplified my project to public api key. It works well until I tried to resize window.So the main problem is that after resizing back and forth images just collapse. After googling for a bit I tried to use masonry('reloadItems') on window resize() event but I don't really know where and how to use it. I would be really glad if someone could help me. Link to codepen project : http://codepen.io/t_zawada/pen/KgVVEg/

2 Answers

The images aren't collapsing for me on the latest Safari and Chrome. Have you already fixed the problem?

They are collapsing after you resize down and back to full size your browser. It still does on every browser.

EDIT: I've changed masonry options. It seems fitWidth: true was causing collapsing after resize. After removing fitWidth: true is no longer collapsing but container is not centered so I have to look out for some other solutions for centering.