Ric*_*ard 40 combobox jquery-ui autocomplete
我的jQuery UI AutoComplete ComboBox在右侧没有滚动条,并且非常不可思议,如下所示.我想将这个列表限制在一个合理的长度 - 有关如何实现这一点的任何想法?谢谢!

j08*_*691 87
您可以通过CSS设置高度:
.ui-autocomplete {
max-height: 600px;
overflow-y: auto; /* prevent horizontal scrollbar */
overflow-x: hidden; /* add padding to account for vertical scrollbar */
z-index:1000 !important;
}
Run Code Online (Sandbox Code Playgroud)
小智 5
这是一个老问题,因此虽然j08691的解决方案适用于较旧的 Primefaces,但现在类名已更改为“ui-autocomplete-list”:
.ui-autocomplete-list {
max-height: 400px;
overflow-y: auto; /* prevent horizontal scrollbar */
overflow-x: hidden; /* add padding to account for vertical scrollbar */
z-index:1000 !important;
}
Run Code Online (Sandbox Code Playgroud)
在某些时候,这又发生了变化,从 jQuery-UI 1.12.1 开始,该类是“ui-autocomplete.ui-front”,因此接受的答案变为:
.ui-autocomplete.ui-front {
max-height: 600px;
overflow-y: auto; /* prevent horizontal scrollbar */
overflow-x: hidden; /* add padding to account for vertical scrollbar */
z-index:1000 !important;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
27783 次 |
| 最近记录: |