如果你嵌套你ul
的,例如......
<div id="portfolionav">
<ul class="filter">
<li>Filter</li>
<ul class="subfilters">
<li class="web"><a href="#">Web</a></li>
<li class="still"><a href="#">Still</a></li>
<li class="motion"><a href="#">Motion</a></li>
<li class="games"><a href="#">Games</a></li>
</ul>
<li class="current all"><a href="#">All</a></li>
</ul>
</div>
过渡的 CSS 更改非常简单:
#portfolionav ul {
display: inline-block;
white-space: nowrap;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
-ms-transition: all 1s ease;
transition: all 1s ease;
}
#portfolionav ul ul {width: 0; opacity: 0;}
#portfolionav ul:hover > ul {width: 370px; opacity: 1;}
http://jsfiddle.net/jukUm/