出于某种原因,我可以点击计算机上的链接,但是当我在移动设备上执行此操作时,这些链接无法正常工作。我甚至无法点击X再次关闭它。
任何人都可以找出问题所在吗?
HTML
<div class="mobilenav" style="display: none;">
<li><a href="/about.html">Story</a></li>
<li><a href="background.html" class="cc-active">Accomplishments</a></li>
<li><a href="experiences.html">Experiences</a></li>
<li><a href="portfolio.html">Portfolio</a></li>
<li><a href="contact.html">Contact</a></li>
</div>
<a href="javascript:void(0)" class="icon">
<div class="hamburger">
<div class="menui top-menu"></div>
<div class="menui mid-menu"></div>
<div class="menui bottom-menu"></div>
</div>
</a>
CSS
.bottom-animate, .top-animate {
background: #1A936F !important;
top: 13px !important
}
* {
-webkit-tap-highlight-color: #1A936F;
-webkit-tap-highlight-color: transparent
}
.top-animate {
-webkit-transform: rotate(45deg);
transform: rotate(45deg)
}
.mid-animate {
opacity: 0
}
.bottom-animate {
-webkit-transform: rotate(-225deg);
transform: rotate(-225deg)
}
.bottom-menu, .mid-menu, .top-menu {
width: 25px;
height: 2px;
border-radius: 10px;
background-color: #F9A530
}
.top-menu {
top: 5px
}
.mid-menu {
top: 13px
}
.bottom-menu {
top: 21px
}
.menui {
background: #1A936F;
transition: .6s ease;
transition-timing-function: cubic-bezier(.75, 0, .29, 1.01);
margin-top: 10px;
position: absolute
}
.icon, .mobilenav {
top: 0;
left: 0;
z-index: 1000;
position: fixed
}
.icon {
display: block;
padding: 9px;
height: 32px;
width: 32px;
margin: 0
}
.mobilenav {
font-family: inherit;
display: none;
width: 100%;
height: 100%;
background: rgba(200, 213, 185, .9)
}
.mobilenav li {
list-style-type: none;
text-align: center;
padding: 10px
}
.mobilenav li a {
font-size: 150%;
color: #1A936F;
text-decoration: none;
font-weight: 300;
width: 100%
}
.mobilenav li:first-child {
margin-top: 60px
}
JS
function togglescroll() {
$("body").on("touchstart", function(e) {
if ($("body").hasClass("noscroll")) {
e.preventDefault()
}
})
}
$(document).ready(function() {
togglescroll();
$(".icon").click(function() {
$(".mobilenav").fadeToggle(500);
$(".top-menu").toggleClass("top-animate");
$("body").toggleClass("noscroll");
$(".mid-menu").toggleClass("mid-animate");
$(".bottom-menu").toggleClass("bottom-animate")
})
});
$(document).keydown(function(e) {
if (e.keyCode == 27) {
$(".mobilenav").fadeOut(500);
$(".top-menu").removeClass("top-animate");
$("body").removeClass("noscroll");
$(".mid-menu").removeClass("mid-animate");
$(".bottom-menu").removeClass("bottom-animate")
}
});