Greetings everyone
I recently created this code pen https://codepen.io/alexyap/full/MmYvLw/. I am facing a challenge with my navigation menu. The transition in works perfectly, but the fade-out effect looks terrible. I'm struggling to figure out this issue.
<div id="nav-container" class="hidden">
<ul>
<li id="nav1" class="hidden"><a href="#">About</a></li>
<li id="nav2" class="hidden"><a href="#">Work</a></li>
<li id="nav3" class="hidden"><a href="#">Contact</a></li>
</ul>
</div>
.hidden {
opacity: 0;
visibility: hidden;
margin-left: -60%;
}
JS:
$("#nav-container").delay(200).queue(function(n){
$(this).toggleClass("hidden")
n()
})
$("#nav1").delay(400).queue(function(n){
$(this).toggleClass("hidden")
n()
})
$("#nav2").delay(600).queue(function(n){
$(this).toggleClass("hidden")
n()
})
$("#nav3").delay(800).queue(function(n){
$(this).toggleClass("hidden")
n()
})
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
Removing the "hidden" class from #nav-container fixes the issue, but it blocks the CTA button on the landing page. My goal is to have the nav menu links transition out one by one after clicking the menu button that changes into an 'X', similar to how it transitions without re-adding the "hidden" class to #nav-container. I apologize if I'm not clear. English is not my first language, but please take a look at my code pen to understand what I mean.