Skip to content

Instantly share code, notes, and snippets.

@panoply
Created October 23, 2018 22:34
Show Gist options
  • Save panoply/649d7cf76f4e434696ef48c7fc4842ac to your computer and use it in GitHub Desktop.
Save panoply/649d7cf76f4e434696ef48c7fc4842ac to your computer and use it in GitHub Desktop.
/* 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