Created
August 23, 2012 16:57
-
-
Save lancewillett/3438707 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
/** | |
* navigation.js | |
* | |
* Handles toggling the navigation menu for small screens. | |
*/ | |
( function() { | |
var button = document.getElementById( 'site-navigation' ).getElementsByTagName( 'h3' )[0], | |
menu = document.getElementById( 'site-navigation' ).getElementsByTagName( 'ul' )[0]; | |
button.onclick = function() { | |
if ( button.className.match( new RegExp( '(\\s|^)toggled-on(\\s|$)' ) ) ) { | |
button.className = 'menu-toggle'; | |
menu.className = 'nav-menu'; | |
} else { | |
button.className = 'menu-toggle toggled-on'; | |
menu.className = 'nav-menu toggled-on'; | |
} | |
}; | |
} )(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment