observer: true,
observeParents: true
function getGridSize() {
const w = window.innerWidth;
return [ 500, 700, 1225, Infinity ].findIndex(n => n > w) + 1;
}
function getGridSize() {
const w = window.innerWidth;
return [
{ size: 1, maxWidth: 500 },
{ size: 2, maxWidth: 700 },
{ size: 3, maxWidth: 1225 },
{ size: 4, maxWidth: Infinity },
].find(n => n.maxWidth > w).size;
}