无法滚动自动完成功能?

时间:2012-02-22 15:32:01

标签: jquery css jquery-ui autocomplete

This是我的代码:

HTML

<input type="textbox" id="txtComune" />
<div id="myOwnMenuComuni" style="position:absolute; top:0; left:0px; height:1px;"></div>  

CSS

.ui-widget-content a 
{
    color: #222222 !important;
    cursor: pointer !important;
    float: left !important;
    width: 100% !important;
    border:1px solid #ffffff;
}  

#myOwnMenuComuni .ui-autocomplete 
{
    width: 200px !important;
    max-height: 150px;
    overflow:auto;
    padding-right:20px;
} 

的jQuery

var listaComuni = ["Abbiategrasso","Acireale","Acquaviva Delle","Acqui Terme","Adelfia","Adrano","Adria","Adro","Agnosine"];

$('#txtComune').autocomplete({
    source: listaComuni,        
    appendTo: "#myOwnMenuComuni"
});​

尝试选择输入,插入“a”,然后选择最后一项:这是不可能的。为什么?我该如何解决这个问题?

2 个答案:

答案 0 :(得分:1)

如果我取消选中“normalize CSS”并链接到jQuery UI CSS,那么它可以正常工作: 的 jsFiddle

答案 1 :(得分:0)

修复了float:left

删除display:block的问题

无论如何,谢谢!