Last active
October 11, 2015 13:47
-
-
Save tored/3867984 to your computer and use it in GitHub Desktop.
toggleClass: removes or add a CSS class to a DOM element
This file contains 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
function toggleClass(el, cls) { | |
if (hasClass(el, cls)) { | |
removeClass(el, cls); | |
} else { | |
addClass(el, cls); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment