jQuery 如何在自动完成中使用“滚动”和“最大”选项
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9590313/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 11:01:28 来源:igfitidea点击:
How to use the 'scroll' and 'max' options in Autocomplete
提问by fmassica
I need help with aucomplete of the jquery.
我需要有关 jquery aucomplete 的帮助。
jQuery("#PeopleName").autocomplete(
{source:["name1","name2","..."],
minLength:2,
max:10,
scroll:true});
The 'scroll' and 'max' are not working.
I am use jquery-ui-1.8.18.custom.min.js.
What is wrong with this code?
“滚动”和“最大”不起作用。
我正在使用 jquery-ui-1.8.18.custom.min.js。这段代码有什么问题?
回答by fmassica
I managed to solve this problem. I found the code in jqueryUI
我设法解决了这个问题。我在jqueryUI 中找到了代码
<style>
.ui-autocomplete {
max-height: 200px;
overflow-y: auto;
/* prevent horizontal scrollbar */
overflow-x: hidden;
/* add padding to account for vertical scrollbar */
padding-right: 20px;
}
</style>
<script>
jQuery("#PeopleName").autocomplete({
source:["name1","name2","..."],
minLength:2
});
</script>
This is working.
这是有效的。