I've got a menu that I want to hide/ show by changing it's top position.
Before I log in the menu looks like this:
<div class="lc">
<h1><a href="./"><img src="logo.png" /></a></h1>
<a href="#" id="menuBtn"></a>
<nav id="mainNav">
<ul>
<li><a href="....php">...</a></li>
<li class="nav-li-..."><a href="....php">...</a></li>
</ul>
</nav>
</div>
After I log in, some items are added:
<div class="lc">
<h1><a href="./"><img src="logo.png" /></a></h1>
<a href="#" id="menuBtn"></a>
<nav id="mainNav">
<ul>
<li><a href="....php">...</a></li>
<li class="nav-li-..."><a href="....php">...</a></li>
<li class="nav-li-..."><a href="....php">...</a></li>
<li class="nav-li-..."><a href="....php">...</a></li>
<li class="nav-li-..."><a href="....php">...</a></li>
<li class="nav-li-..."><a href="....php">...</a></li>
</ul>
<div class="nav-admin">
<strong>Administrator links:</strong><br />
<a href="....php?users">...</a><br />
<a href="....php?user_logs">...</a><br />
<a href="....php?dealer_logs">...</a><br />
<a href="....php?herd_logs">...</a><br />
<a href="....php?php_logs">...</a>
</div>
</nav>
</div>
This CSS belongs to it:
.lc, nav, h1 {
background: #fdf6bf;
background: #FDD;
}
.lc {
position: fixed;
z-index: 200;
width: 14em;
height: 100%;
top: 0;
left: 0;
padding-top: .5em;
overflow: auto;
}
h1 {
width: 100%;
font-size: 1em;
margin-top: 0;
margin-bottom: .5em;
}
h1 a {
display: block;
width: 100%;
text-align: center;
}
h1 a img { max-width: 70%; }
nav ul { list-style: none; }
nav ul li { padding: .75em 0 .75em 4.25em; }
nav ul li.is-active { background: #fdf9dc; }
nav ul li.is-active a:after {
content: "\232A";
position: absolute;
right: .25em;
top: -.05em;
font-size: 3em;
height: 1em;
line-height: 1em;
vertical-align: middle;
color: #c9c49d;
}
nav ul a,
.btn-add {
display: block;
position: relative;
height: 3em;
padding-left: 1em;
line-height: 3em;
vertical-align: middle;
font-family: 'Exo', sans-serif;
text-decoration: none;
color: #4f4e4c;
font-size: 1em;
font-weight: 600;
}
nav ul a:before,
.btn-add:before {
content: '';
position: absolute;
right: 100%;
top: 50%;
margin-top: -1.75em;
width: 3.5em;
height: 3.5em;
background: url(images/menu_home.png) center center no-repeat;
background-size: cover;
}
.nav-show { top: 0; }
.no-scroll { overflow: hidden; }
@media screen and (max-width: 550px) {
* { font-size: 1em; }
nav {
position: fixed;
z-index: 180;
top: -100%;
left: 0;
padding-top: 4.5em;
width: 100%;
height: 100%;
overflow: auto;
-webkit-transition: all 1s ease-in-out;
-moz-transition: all 1s ease-in-out;
-o-transition: all 1s ease-in-out;
transition: all 1s ease-in-out;
background: #fffad5;
}
nav ul li.is-active { background: #fffcea; }
.lc {
position: fixed;
width: 100%;
height: 3.5em;
overflow: hidden;
}
To trigger the menu I use
$(function() {
$('#menuBtn').on('click', function(e) {
$('body').toggleClass('no-scroll');
$('#mainNav').toggleClass('nav-show');
e.preventDefault();
});
});
The problem is that the menu does show before the login. But after that, I am not able to open the menu. This problem isn't on the desktop PC, but only on mobile phones (Android). I've tried various phones and browser, but they all have the same issue.
Anyone got an idea?