Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from kovshenin/patch-8
Replace small-menu.js with navigation.js inspired by Twenty Twelve.
- Loading branch information
Showing
5 changed files
with
48 additions
and
43 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* navigation.js | ||
* | ||
* Handles toggling the navigation menu for small screens. | ||
*/ | ||
( function() { | ||
var button = document.getElementById( 'site-navigation' ).getElementsByTagName( 'h1' )[0], | ||
menu = document.getElementById( 'site-navigation' ).getElementsByTagName( 'ul' )[0]; | ||
container = document.getElementById( 'site-navigation' ); | ||
|
||
if ( undefined == button || undefined == menu ) | ||
return false; | ||
|
||
button.onclick = function() { | ||
if ( -1 == menu.className.indexOf( 'nav-menu' ) ) | ||
menu.className = 'nav-menu'; | ||
|
||
if ( -1 != button.className.indexOf( 'toggled-on' ) ) { | ||
button.className = button.className.replace( ' toggled-on', '' ); | ||
menu.className = menu.className.replace( ' toggled-on', '' ); | ||
container.className = container.className.replace( ' main-small-navigation', ' main-navigation' ); | ||
} else { | ||
button.className += ' toggled-on'; | ||
menu.className += ' toggled-on'; | ||
container.className = container.className.replace( ' main-navigation', ' main-small-navigation' ); | ||
} | ||
}; | ||
|
||
// Hide menu toggle button if menu is empty. | ||
if ( ! menu.childNodes.length ) | ||
button.style.display = 'none'; | ||
} )(); |
This file was deleted.
Oops, something went wrong.
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