javascript Jquery 自动完成建议 - 小字体列表
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19824820/
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
Jquery autocomplete suggestions - small font list
提问by user2957598
Jquery Autocomplete suggestions list font is very bigger ,I want to be small like typing in text box font need. how to restrict with small fonts in suggestions list ? Please see the below screen and code:
Jquery 自动完成建议列表字体非常大,我想要像在文本框中输入字体一样小。如何限制建议列表中的小字体?请参阅以下屏幕和代码:
<!DOCTYPE>
<html>
<head>
<title>Auto Complete in JSP Java</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
<STYLE TYPE="text/css" media="all">
.ui-autocomplete {
position: absolute;
cursor: default;
height: 200px;
overflow-y: scroll;
overflow-x: hidden;}
</STYLE>
<script>
$(function() {
$("#names").autocomplete({
source: function(request, response) {
$.ajax({
url: "searchName.jsp",
type: "POST",
dataType: "json",
data: { name: request.term},
success: function( data, textStatus, jqXHR) {
var items = data;
response(items);
},
error: function (error) {
alert('error: ' + error);
}
});
},
minLength: 3
});
});
</script>
</head>
<body>
<input type="text" name="name" id="names" />
</body>
</html>
回答by lukpaw
It is defined in:
它定义在:
.ui-widget {
font-family: Verdana,Arial,sans-serif;
font-size: 10px;
}
But you may precede it something e.g.
但是你可以在它之前做一些事情,例如
.ui-autocomplete.ui-widget {
font-family: Verdana,Arial,sans-serif;
font-size: 10px;
}
回答by Defoncesko
for example :
例如 :
$('.ui-autocomplete-input').css('fontSize', '10px');
Information on styling the Autocomplete widget can be found here:
可以在此处找到有关设置自动完成小部件样式的信息:
The ul
markup following the ui-autocomplete-input
is the results it generates. By targeting ul.ui-autocomplete.ui-menu
you should get what you need.
在ul
以下的标记ui-autocomplete-input
是它产生的结果。通过瞄准ul.ui-autocomplete.ui-menu
你应该得到你需要的东西。