在做项目的时候需要用到jquery-ui 的 autoComplete 插件中的 组合框combobox
按照官方网站给的代码敲,如果select 的 option 过多的话
会出现下拉后框过长,那如何将这个下拉框弄小呢
找到引用的jquery-ui.css
搜索 .ui-autocomplete 这个css类的定义
修改为
.ui-autocomplete {
position: absolute;
top: 0;
left: 0;
cursor: default;
overflow-y:scroll;
overflow-x:hidden;
max-height: 200px;
}
就可以解决
当然,对于低版本的IE,可能会不识别max-height
那就在上述代码后加上
_height:expression(this.scrollHeight >200 ? "200px" : "auto");
就可以实现了