Skip to content

Instantly share code, notes, and snippets.

@Yang03
Created June 8, 2018 09:12
Show Gist options
  • Save Yang03/a32b3243d02a24c1beeea316246a1c69 to your computer and use it in GitHub Desktop.
Save Yang03/a32b3243d02a24c1beeea316246a1c69 to your computer and use it in GitHub Desktop.
xx.js
var subItems = Array.from(document.querySelectorAll('.sub-item'))
subItems.forEach((item) => {
item.onclick = function() {
var classList = this.classList
if (classList.contains('animation-open')) {
classList.remove('animation-open')
} else {
classList.add('animation-open')
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment