我的解决方案是在li元素上设置高度转换,而不是ul,这样就不必推断总高度.
这是一个有效的解决方案:http://jsfiddle.net/siorge/w55rZ/2/
编辑以显示代码:
/*ul Styles*/
.menu-item ul li {
background: #fff;
font-size: 13px;
line-height: 30px;
height: 0px;
list-style-type: none;
overflow:hidden;
padding: 0px;
/*Animation*/
-webkit-transition: height 1s ease;
-moz-transition: height 1s ease;
-o-transition: height 1s ease;
-ms-transition: height 1s ease;
transition: height 1s ease;
}
.menu-item:hover li {
height: 32px;
border-bottom: 1px solid #eee;
}
Run Code Online (Sandbox Code Playgroud)