Changed the mobile nav menu so that it wouldn't cause problems with page layout

This commit is contained in:
William Brawner 2016-03-10 08:43:16 -06:00
parent 1e155009f6
commit 8280d8625e
2 changed files with 46 additions and 33 deletions

View file

@ -90,6 +90,11 @@ input[type='submit'] {
text-decoration:none; text-decoration:none;
} }
#menu-container {
overflow-x: hidden;
display: inline;
}
.main-nav ul { .main-nav ul {
float:right; float:right;
margin-top:-5px; margin-top:-5px;
@ -492,16 +497,16 @@ a.social-link:hover, a.social-link:active {
} }
#menu { #menu {
display:block; display:none;
width:100vw; opacity:0;
width:100%;
position: absolute; position: absolute;
top: 60px; top: 60px;
left: 100%;
padding:0; padding:0;
background-color:#002900; background-color:#002900;
float:none; float:none;
-webkit-transition: left 0.5s ease; -webkit-transition: opacity 0.5s ease;
transition: left 0.5s ease; transition: opacity 0.5s ease;
} }
#menu-icon { #menu-icon {

View file

@ -30,6 +30,7 @@
<nav class="main-nav"> <nav class="main-nav">
<h1><a href="/">william brawner</a></h1> <h1><a href="/">william brawner</a></h1>
<a href="javascript:void(0)" id="menu-icon"><i class="fa fa-bars "></i></a> <a href="javascript:void(0)" id="menu-icon"><i class="fa fa-bars "></i></a>
<div id="menu-container">
<ul id="menu"> <ul id="menu">
{% if session.logged_in and session.admin %} {% if session.logged_in and session.admin %}
<li> <li>
@ -53,6 +54,7 @@
<a href="{{ url_for('contact') }}">contact</a> <a href="{{ url_for('contact') }}">contact</a>
</li> </li>
</ul> </ul>
</div>
</nav> </nav>
<div class="container"> <div class="container">
<div class="content"> <div class="content">
@ -83,11 +85,17 @@
var menuVisible = false; var menuVisible = false;
$('#menu-icon').click(function() { $('#menu-icon').click(function() {
if (menuVisible) { if (menuVisible) {
$('#menu').css({'left':'100%'}); $('#menu').css({'opacity':'0'});
setTimeout(function() {
$('#menu').css({'display':'none'});
}, 500);
menuVisible = false; menuVisible = false;
return; return;
} }
$('#menu').css({'left':'0'}); $('#menu').css({'display':'block'});
setTimeout(function() {
$('#menu').css({'opacity':'1'});
}, 100);
menuVisible = true; menuVisible = true;
}); });
}); });