Here is a solution that target the second animation in the link. Still a draft though.
http://jsfiddle.net/NicoO/T4Nbk/5/
Update: Max-height is causing speed issues, making the feeling the transition too fast or slow. Here is an alternative solution using transforms: http://jsfiddle.net/NicoO/T4Nbk/7/ same version with Chrome vendor prefixes: http://jsfiddle.net/T4Nbk/9/
CSS:
ul
{
margin: 0;
padding: 0;
}
ul > li
{
display: inline-block;
position: relative;
}
ul > li li
{
display: block;
}
ul > li:before
{
background-color:gray;
top: 100%;
bottom:0;
left: 0;
right: 0;
position: absolute;
content: "";
transition-duration: 0.4s;
z-index:-1;
}
ul > li a
{
display: block;
position: relative;
}
ul > li ul
{
max-height: 0;
overflow: hidden;
position: absolute;
left:0;
width: 300px;
background-color: gray;
transition-duration: 0.4s;
transition-property: max-height;
}
ul > li:hover:before
{
top:0;
}
ul > li:hover ul
{
max-height: 400px;
}
HTML:
<nav>
<ul>
<li>Home</li>
<li>News & Events</li>
<li>
Discover
<ul>
<li>Jordan</li>
<li>Jordan</li>
</ul>
</li>
</ul>
</nav>
CSS of the solution using transforms:
Inspired by: How can I transition height: 0; to height: auto; using CSS?
ul
{
margin: 0;
padding: 0;
}
ul > li
{
display: inline-block;
position: relative;
}
ul > li li
{
display: block;
}
ul > li:before
{
background-color:gray;
top: 100%;
bottom:0;
left: 0;
right: 0;
position: absolute;
content: "";
transition-duration: 0.4s;
z-index:-1;
}
ul > li a
{
display: block;
position: relative;
}
ul > li ul
{
transform: scaleY(0);
transition: transform 0.4s;
transform-origin: top;
overflow: hidden;
position: absolute;
left:0;
width: 300px;
background-color: gray;
}
ul > li:hover:before
{
top:0;
}
ul > li:hover ul
{
transform: scaleY(1);
}