I am using the vanilla JS version of Isotope to create a filter function like so
isotope.arrange({
filter: function(element) {
console.log(element)
However, the value returned for the variable element is 0 and not an HTMLElement like it is on my local machine.
When logging the isotope.getItemElements() beforehand it returns all the items so I know it has been instantiated correctly.
Any Help would be much appreciated
So I think the documentation is not correct https://isotope.metafizzy.co/filtering.html#functions states the following
iso.arrange({
// item element provided as argument
filter: function( itemElem ) {
var number = itemElem.querySelector('.number').innerText;
return parseInt( number, 10 ) > 50;
}
});
However in my test case https://codepen.io/matthewattanasio/pen/qBOjeMr the filter function has two arguments and its the second argument that returns the element e.g. the above code should actually be
iso.arrange({
// item element provided as argument
filter: function( itemElem1, itemElem2 ) {
var number = itemElem2.querySelector('.number').innerText;
return parseInt( number, 10 ) > 50;
}
});