I try to do a dropdown menu on click. I tried to toggle two classes when i click on the "Menu" and transition between 0 max-height and 20 em max-height on my navbar. But as I see when i have 0 max-height it's taking a white space like a placeholder. i dont want that because it messes my aspect of the website . I was thinking at display:block and display:none but i know you can't transitione between these two . Is there any way to create a dropdown menu on click when i click on a specified place ? EDIT :
i have this code:
html :
<header>
<nav>
<div class="handle">Menu</div>
<ul>
<li><a id="active" href="index.html">HOME</a></li>
<li><a href="collection.html">PRODUCTS</a></li>
<li><a href="events.html">EVENTS</a></li>
<li><a href="info.html">CONTACT</a></li>
</ul>
</nav>
</header>
and css:
.handle{
width: 100%;
background:#333333;
text-align: left;
box-sizing: border-box;
padding:15px 10px;
cursor: pointer;
display: none;
color: white;
box-sizing: border-box;
}
@media (max-width:980px){
.showing{
max-height:20em ;
}
nav ul{
max-height: 0;
}
}
and the JS :
$(document).ready(function () {
$('.handle').on('click', function () {
$('nav ul').toggleClass('showing')
});
});
There is some more styling to the header but i think is not important.Sorry if i was unclear .
"this".str_rev();!