JQuery UI自动完成(1.8)滚动
i'm having troubles configuring the autocomplete module of JQuery-UI. I need that when the amount of data to select is big enough an scroll bar appears.
我在配置JQuery-UI的自动完成模块时遇到了麻烦。当要选择的数据量足够大时,就需要一个滚动条。
This is what i tried:
这就是我所尝试的:
- in the
jquery-ui-1.8.16.css
i've setted this: - jquery-ui-1.8.16。css我设置:
ui.autocomplete{ max-height: 100px; overflow-y: auto; overflow-x: hidden; }
ui。自动完成{ max-height:100 px;overflow-y:汽车;overflow-x:隐藏;}
*as shown in the ui-documentation example
*如ui文档示例所示
This is how i declare and autocomplete input:
这是我如何声明和自动完成输入:
$("#myInput").autocomplete({ source: mySource, minLength: 0, });
$(" # myInput”)。自动完成({源:mySource, minLength: 0,});
I dont know why the scroll bar does not appear, any help would be appreciated. Thank you very much!
我不知道为什么滚动条没有出现,请帮忙。非常感谢!
1 个解决方案
#1
68
You should override the css setting it in the page like this
您应该重写css在页面中的设置,如下所示
<style>
.ui-autocomplete {
max-height: 100px;
overflow-y: auto;
/* prevent horizontal scrollbar */
overflow-x: hidden;
/* add padding to account for vertical scrollbar */
padding-right: 20px;
}
/* IE 6 doesn't support max-height
* we use height instead, but this forces the menu to always be this tall
*/
* html .ui-autocomplete {
height: 100px;
}
</style>
instead of changing values in jquery-ui-1.8.16.css
而不是在jquery-ui-1.8.16.css中更改值
更多相关文章
- day049--jQuery文档操作示例
- HTML+jQuery图片上传示例
- 经典炫酷的HTML5/jQuery动画应用示例及源码
- PHP实现WebSocket示例
- PHP的$ _GET和URL重写
- PHP基础示例:商品信息管理系统v1.1[转]
- 040-PHP使用闭包函数来进行父实例的变量自增,正确示例
- mysql锁机制之示例讲解
- MySQL 示例数据库sakila