Skip to content

Instantly share code, notes, and snippets.

@giuseppeg
Created January 11, 2022 23:11
Show Gist options
  • Save giuseppeg/46592356d7c1579f488eddbd6042be44 to your computer and use it in GitHub Desktop.
Save giuseppeg/46592356d7c1579f488eddbd6042be44 to your computer and use it in GitHub Desktop.
// setup
let classes = ['a','b','c']
let counter = 0
el.classList.add(classes[counter])
function rotate() {
counter++
el.classList.replace(
classes[(counter-1) % classes.length],
classes[(counter) % classes.length]
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment