1
Good morning guys, I’m developing a project and it has a header that I developed showing the available categories of it. Layout of the site with Bootstrap 3.3, already for presentation reasons I decided to make an animation in the CSS of the dropdown appearing and expanding, when giving the click worked perfectly, but when blurring giving a click on something else it just disappears, I would like to make the reverse so that this dropdown goes away, I have consulted W3 Schools but I have not found a solution to this problem.
Here is the code below.
HTML:
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li <?=$page=='index.php' ? 'class="active"' : '';?>>
<a href="index.php">HOME</a>
</li>
<li <?=$page=='empresa.php' ? 'class="active"' : '';?>>
<a href="empresa.php">EMPRESA</a>
</li>
<li class="dropdown <?=$page=='areas.php' ? 'active' : '';?>">
<a class="dropdown-toggle" href="Javascript:void(0);" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">ÁREAS DE ATUAÇÃO</a>
<ul class="dropdown-menu">
<? while($row_rsArea = mysql_fetch_assoc($rsArea)) { ?>
<li>
<a href="area.php?id=<?=$row_rsArea['area_id'];?>" class="text-uppercase"><?=$row_rsArea['area_titulo'];?></a>
</li>
<? } ?>
</ul>
</li>
<li <?=$page=='equipamentos.php' ? 'class="active"' : '';?>>
<a href="equipamentos.php">EQUIPAMENTOS</a>
</li>
<li <?=$page=='clientes.php' ? 'class="active"' : '';?>>
<a href="clientes.php">CLIENTES</a>
</li>
<li <?=$page=='contato.php' ? 'class="active"' : '';?>>
<a href="contato.php">CONTATO</a>
</li>
</ul>
</div>
CSS:
.dropdown-menu {
text-align: center;
max-height: 0px;
transition: all 2s ease;
overflow: hidden;
}
.open>.dropdown-menu {
-webkit-animation-name: dropdown; /* Safari 4.0 - 8.0 */
-webkit-animation-duration: 2s; /* Safari 4.0 - 8.0 */
-webkit-animation-fill-mode: forwards; /* Safari 4.0 - 8.0 */
animation-name: dropdown;
animation-duration: 2s;
animation-fill-mode: forwards;
}
/* Standard syntax */
@keyframes dropdown {
0% {display: none;}
25% {display: block;}
50% {max-height: 250px;}
100% {max-height: 500px;}
}
/* Safari 4.0 - 8.0 */
@-webkit-keyframes dropdown {
0% {display: none;}
25% {display: block;}
50% {max-height: 250px;}
100% {max-height: 500px;}
}
It worked! Thanks for the help friend.
– Alex Borgmann
@aleque_b quiet young tmj
– hugocsl