Skip to content

Instantly share code, notes, and snippets.

@michelmany
Last active May 7, 2020 07:11
Show Gist options
  • Save michelmany/8fd208a37d045f6826ebd5f6024e4899 to your computer and use it in GitHub Desktop.
Save michelmany/8fd208a37d045f6826ebd5f6024e4899 to your computer and use it in GitHub Desktop.
Init Isotope Layout JS with ES6 ( https://isotope.metafizzy.co/ )
const grid = document.querySelector(".sorteios__grid-items");
const gridFilterButtons = document.querySelectorAll(".sorteios__grid-filter button");
const iso = new Isotope(grid, {
itemSelector: ".sorteios__grid-item",
masonry: {
gutter: 10,
},
});
gridFilterButtons.forEach((filterButton) => {
filterButton.addEventListener("click", () =>
iso.arrange({ filter: filterButton.dataset.filter })
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment