【发布时间】:2014-05-12 06:11:24
【问题描述】:
我正在使用 Bootstrap 3,并且我有一个 autossugest 输入。问题是我希望<ul> 用键盘键滚动,但它不起作用。我认为使用箭头键滚动是一种默认行为,但 <ul> 不会这样做。这是正在发生的事情:
如果我按两次向下键:
我使用的是 Bassjobsen 开发的typeahead。
HTML 代码:
<input type="text" class="form-control" data-provide="typeahead" id="test">
Javascript(带有 JQuery.js)代码:
$('document').ready (function () {
$('#test').typeahead({
source: ['algo', 'pepe', 'algo2', 'algo34', 'pepe3', 'algo42'],
items: 'all',
minLength: 2
});
});
我将items 设置为all 以显示source 中的所有项目。这就是为什么我需要滚动它们。
我将这个内联样式添加到生成的<ul>:
style="max-height: 50px; overflow-y: auto;"
这是 Bassjobsens 库生成的代码:
<ul class=" dropdown-menu" style="max-height: 50px; overflow-y: auto; top: 73px; left: 20px; display: none;" "="">
<li class="active">
<a href="#"><strong>al</strong>go</a>
</li>
<li>
<a href="#"><strong>al</strong>go2</a>
</li>
<li>
<a href="#"><strong>al</strong>go34</a>
</li>
<li>
<a href="#"><strong>al</strong>go42</a>
</li>
</ul>
【问题讨论】:
-
关于该问题的任何更新?
-
你修好了吗?
标签: javascript html css twitter-bootstrap-3 bootstrap-typeahead