Twitter类型自动完成高亮选择

5

我在我的页面上实现了Twitter Type Ahead,看起来很不错。但是出现一个问题,当我使用箭头向下浏览建议列表时,项目没有被高亮显示,但它们会填充文本框。然而,当我用鼠标悬停在建议的下拉菜单上时,项目会被高亮显示。是否有某种原因导致箭头浏览时项目无法高亮显示?如果有,我该如何解决?

myTypeahead= $('#txtBox').typeahead({
            name: 'typeahead',
            valueKey: "Value",
            remote: 'serviceHander.ashx',
            template: ['<p>{{Value}}</p>'],
            engine: Hogan,
        });
2个回答

11

被选中的建议会获得类名 .tt-cursor。

.tt-cursor{
    color:#f1b218;
}

7

找到答案了。

原来我的CSS属性被继承了,我必须明确设置.tt-is-under-cursor,如下所示:

.tt-is-under-cursor {
    background-color: #000000!important;
    color: #FFFFFF !important;
}

更新

该类已更名为.tt-cursor

示例:

.tt-cursor {
    background-color: #000000!important;
    color: #FFFFFF !important;
}

当前版本(0.10.5)已将CSS类重命名为tt-cursor - Jeremy

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接