I'm developing a website, and in its header it should contain a Dropdown that appears when giving a hover in the header link, preferably with the animation of it popping up, however it has a bug that when you go to the dropdown it tries to hide, and then appears again. With pure CSS I managed to do it without the slide animation, but I would like to give a stylized one in it, I already tried with the pure CSS with transition and the animations of @webkit.
Here is the code below:
HTML:
<li id="showDropdown" <?=$page=='areas.php' ? 'class="active"' : '';?>>
<a class="areas" href="Javascript:void(0);">ÁREAS DE ATUAÇÃO</a>
<ul class="dropdown-areas">
<? while($row_rsAreas = mysql_fetch_assoc($rsArea)) { ?>
<li>
<a href="area.php?id=<?=$row_rsAreas['area_id'];?>"><?=$row_rsAreas['area_titulo'];?></a>
</li>
<? } ?>
</ul>
</li>
CSS:
.dropdown-areas {
text-align: left;
background-color: rgba(54, 52, 53, 0.9);
padding: 10px 0;
width: 100%;
display: none;
position: absolute;
}
.dropdown-areas li {
padding: 10px 0 10px 20px;
width: 100%;
list-style-type: none;
}
.dropdown-areas li a {
border-left: 3px solid var(--corFont);
padding-left: 10px;
}
SCRIPT:
$(document).ready(function() {
$('#showDropdown').hover(function() {
$('.dropdown-areas').slideToggle(1000);
});
});