O'Reilly logo

Instant jQuery Masonry How-to by Kyle David Taylor

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding and reloading (Advanced)

When working on specialized projects, sometimes you need to build a feature that may involve adding additional content to a page, either through AJAX or through manual processes like comments and submissions. Fortunately for us, not only can we add new content to the Masonry container, we can also trigger Masonry to reload all the items to realign all Masonry elements back into a proper grid.

Getting ready

In the code bundle for this book, open the 5-add-reload.html file in your preferred text editor to follow along. For this exercise, we will be using a small jQuery plugin called Placeholder.js to generate random text when adding new elements. Placeholder.js can be found at the following URL:

https://github.com/decabear/placeholderjs/blob/master/placeholder.min.js ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required