-1

I am using the wonderful masonry cascading grid layout library to display a number of projects on my website.

This is my javascript:

var container = document.querySelector('#projects');
var msnry = new Masonry( container, {
  // options
  columnWidth: 280,
  itemSelector: '.project'
});

Now, in the sidebar of my website I am also listing the various categories that my projects belong to, so a user can filter them.

It would be nice if a click on a category would also trigger the masonry effect, a bit like in this example.

How can this be achieved?

I am fairly new to Javascript and jQuery, so the solution is probably a simple one.

Thanks for any help.

Tintin81
  • 8,860
  • 17
  • 66
  • 143

2 Answers2

0

It can be done by appending new bricks to the container and run it with masonry.reload() with option animate enable. Instead to use append you can also use prepend. You can also check this site http://www.maxmedia.com.

Gigamegs
  • 12,342
  • 7
  • 31
  • 71
-2

Take a peek at the JQuery Isotope plugin: http://isotope.metafizzy.co/

It can do sorting and filtering in the Masonry style.

JimTheDev
  • 3,399
  • 1
  • 21
  • 26