Created
January 3, 2017 22:03
-
-
Save rudyjahchan/630944a506523c0940f9377f1c81c2e5 to your computer and use it in GitHub Desktop.
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
jQuery(($) => { | |
$("#menu-toggle").click((evt) => { | |
evt.preventDefault(); | |
$('.menu-activable').toggleClass('menu-active'); | |
return false; | |
}); | |
}); |
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 toggleMenuActive(element) { | |
element.classList.toggle('menu-active'); | |
} | |
function onMenuClick(event) { | |
event.preventDefault(); | |
const activableElements = document.getElementsByClassName('menu-activable'); | |
Array.prototype.forEach.call(activableElements, toggleMenuActive); | |
return false; | |
} | |
document.addEventListener("DOMContentLoaded", function(event) { | |
const toggle = document.getElementById('menu-toggle'); | |
toggle.addEventListener('click', onMenuClick); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment