Created
October 23, 2018 22:34
-
-
Save panoply/649d7cf76f4e434696ef48c7fc4842ac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* toggleGrid (body) { | |
const toggle = body.querySelector('#filter-grid') | |
const collection = body.querySelector('#collection-products') | |
const products = collection.querySelectorAll('.col-6') | |
toggle.onclick = event => { | |
return { | |
small: () => { | |
products.forEach(el => { | |
el.className = 'col-2 p-2' | |
}) | |
}, | |
medium: () => { | |
products.forEach(el => { | |
el.className = 'col-3 p-2' | |
}) | |
}, | |
large: () => { | |
products.forEach(el => { | |
el.className = 'col-4 p-2' | |
}) | |
} | |
}[event.target.dataset.grid]() | |
} | |
} */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment