Coding my way

4 years ago in Javascript · 1 MIN READ

Toggle Sorting Isotope elements

[Isotope by metafizzy]( \"Isotope layout plugin from metafizzy\") is a great plugin that can create interesting and creative layouts, even for large amounts of data.

While it can re-flow the layout with masonry and a few other layout modes, what separates it from [desandro's masonry]( \"Masonry layout plugin from Desandro\") is the ability to sort, and filter the elements.

In the following fiddle I've created a toggle sorting method, which is currently missing from the examples site, and can be difficult for some who are unfamiliar with javasript and jQuery.

If you want single button sorting then you only need to do 2 things:

  1. Remove and rename half of the sorting buttons
  2. In the click event listener, you need the reverse the sorting direction for the next click

And that is all!

Could be even simpler? If so, don't keep it to yourself and share it! We develop the web together!


Miklós Galicz

I'm a hobbyist who managed to become a professional web developer who specializes in Laravel and Vue.js, also the Spice must flow.
comments powered by Disqus

© 2019 DevBlog