have got this problem when i click on my "hamburger icon" in mobile view..it drops down the mobile nav, but...then immediately slides it back up instantly? This is code that i have not written so finding it hard to decipher...any help would be great.
Here is the code I am working with....
General.nav.init = function() {
jQuery(".mobile-opener").on("click", function(a) {
a.preventDefault(), jQuery("#main-nav .primary").slideToggle(), jQuery(this).toggleClass("open");
}), jQuery("#nav").scrollToFixed({
minWidth: "1024"
});
and the code it targets....
<div class="purple" id="nav">
<nav id="main-nav" class="container">
<a href="#" class="mobile-opener"></a>
<ul class="primary">
<li class="home"><a href="#">Home</a></li>
<li><a href="#">Find an event</a></li>
<li><a href="#">Organise your own event</a></li>
<li><a href="#">About us</a></li>
<li><a href="#">Contact us</a></li>
</ul>
<ul class="pull-right secondary">
<li class="blue-item"><a href="#">Donate</a></li>
<li class="green-item"><a href="#"><span class="mob-hide">Get your </span>fundraising pack</a></li>
</ul>
</nav>
**update it only seems to be effecting when viewed on mobile device, it works ok in browser?
在第3行尝试a.stopPropagation()
而不是a.preventDefault()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.