Last active
December 8, 2019 13:49
-
-
Save vosidiy/12cff3a34c8b579518fae050832923d3 to your computer and use it in GitHub Desktop.
Menu with hover animation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<nav class="navbar navbar-expand-lg navbar-dark bg-primary"> | |
<a class="navbar-brand" href="#">Brand</a> | |
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#main_nav" aria-expanded="false" aria-label="Toggle navigation"> | |
<span class="navbar-toggler-icon"></span> | |
</button> | |
<div class="collapse navbar-collapse" id="main_nav"> | |
<ul class="navbar-nav"> | |
<li class="nav-item active"> <a class="nav-link" href="#">Home </a> </li> | |
<li class="nav-item"><a class="nav-link" href="#"> About </a></li> | |
<li class="nav-item"><a class="nav-link" href="#"> Services </a></li> | |
<li class="nav-item dropdown"> | |
<a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown"> Hover up </a> | |
<ul class="dropdown-menu fade-up"> | |
<li><a class="dropdown-item" href="#"> Submenu item 1</a></li> | |
<li><a class="dropdown-item" href="#"> Submenu item 2 </a></li> | |
<li><a class="dropdown-item" href="#"> Submenu item 3 </a></li> | |
</ul> | |
</li> | |
</ul> | |
</div> <!-- navbar-collapse.// --> | |
</nav> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ============ only desktop view ============ */ | |
@media all and (min-width: 992px) { | |
.navbar .nav-item .dropdown-menu{ display:block; opacity: 0; visibility: hidden; transition:.3s; margin-top:0; } | |
.navbar .nav-item:hover .nav-link{ color: #fff; } | |
.navbar .dropdown-menu.fade-down{ top:80%; transform: rotateX(-75deg); transform-origin: 0% 0%; } | |
.navbar .dropdown-menu.fade-up{ top:180%; } | |
.navbar .nav-item:hover .dropdown-menu{ transition: .3s; opacity:1; visibility:visible; top:100%; transform: rotateX(0deg); } | |
} | |
/* ============ desktop view .end// ============ */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment