-
-
Save tschiemer/f887608fa94911a1f451 to your computer and use it in GitHub Desktop.
HelpDeskZ foldable, responsive menu example
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
CHANGE: | |
//from | |
... | |
input[type="button"], input[type="submit"]{ | |
... | |
//to | |
... | |
input[type="button"], input[type="submit"], button { | |
.. | |
NEW: | |
#logo { | |
float: left; | |
display: inline-block; | |
} | |
#navbar-responsive { | |
display: none; | |
float: right; | |
margin: 10px; | |
} | |
@media (max-width: 640px) { | |
#navbar {display:none} | |
#navbar.expanded {display:block} | |
} | |
@media (max-width: 640px) { | |
#navbar-responsive {display: inline-block;} | |
} |
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 toggleMenu(){ | |
if ($('#navbar').hasClass('expanded')){ | |
$('#navbar').removeClass('expanded'); | |
} else { | |
$('#navbar').addClass('expanded'); | |
} | |
} | |
// the menu is expanded by default because not everybody has JS enabled, thus for all those who have it enabled, fold menu | |
$(document).ready(function(){ | |
$('#navbar').removeClass('expanded'); | |
}); |
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
Assumed you have downloaded and installed icons from http://genericons.com/ into css folder |
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
<head> | |
... | |
<link href="{{ settings.site_url }}/css/style.css" rel="stylesheet" type="text/css" /> | |
<!-- NEW --> <link href="{{ settings.site_url }}/css/genericons.css" rel="stylesheet" type="text/css" /> | |
<script type="text/javascript" src="{{ settings.site_url }}/js/jquery.js"></script> | |
<!-- NEW --> <script type="text/javascript" src="{{ settings.site_url }}/js/site.js"></script> | |
... | |
</head> | |
<body> | |
<div id="wrapper"> | |
<div id="header"> | |
<div id="logo"> | |
<a href="{{ settings.site_url }}"></a> | |
</div> | |
<!-- NEW start--> | |
<div id="navbar-responsive"> | |
<button onclick="toggleMenu();"><span class="genericon genericon-menu"></span></button> | |
</div> | |
<div class="clear"></div> | |
<!-- NEW end --> | |
</div> | |
<div id="navbar" class="expanded"> <-- add class expanded as a default --> | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment