[英]dropdown menu display effect
I have a dropdown button that display 2 options when clicked I want the option to display like fading in and out when the dropdown is clicked. 我有一个下拉按钮,单击时显示2个选项。我希望该选项在单击下拉菜单时像淡入和淡出一样显示。
HTML 的HTML
<select name="lang_choice" id="lang_choice">
<option value="da" selected="selected">Dansk</option>
<option value="en">English</option>
</select>
CSS 的CSS
select
{
background: #E6E0D0;
color: #694a31;
width: 100px;
}
i tried to add this to my css but nothing happens also tried the opacity 0 > 1 when display but it doesn't affect the menu. 我试图将其添加到我的CSS,但什么也没有发生也尝试了显示时不透明度0> 1,但它不影响菜单。
-webkit-transition: opacity .5s ease-in-out;
-moz-transition: opacity .5s ease-in-out;
-ms-transition: opacity .5s ease-in-out;
-o-transition: opacity .5s ease-in-out;
transition: opacity .5s ease-in-out;
Well you can try jQuery animation, but it seems that opacity
only affects the option text and not the block where it is stored. 可以尝试使用jQuery动画,但是
opacity
似乎只会影响选项文本,而不会影响其存储位置。
jsfiddle: http://jsfiddle.net/2dvcam8f/5/ jsfiddle: http : //jsfiddle.net/2dvcam8f/5/
new jsfiddle with better animation: http://jsfiddle.net/2dvcam8f/9/ 具有更好动画效果的新jsfiddle: http : //jsfiddle.net/2dvcam8f/9/
If you want smooth drop downs you should use plugins, for example the one @Rushee posted. 如果要平滑下拉列表,则应使用插件,例如发布的一个@Rushee。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.