最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Twitter Type Ahead Highlight Selection - Stack Overflow

programmeradmin7浏览0评论

I have implemented the Twitter Type Ahead on my page and it looks great. But for some reason when I arrow down the list of suggestions, the items are not highlighted, but they populate the text box. However, when I hover over the drop down of suggestions with my mouse, the items are highlighted. Is there a reason why the items would not highlight when arrow'd through? If so, how can I accomplish this?

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

I have implemented the Twitter Type Ahead on my page and it looks great. But for some reason when I arrow down the list of suggestions, the items are not highlighted, but they populate the text box. However, when I hover over the drop down of suggestions with my mouse, the items are highlighted. Is there a reason why the items would not highlight when arrow'd through? If so, how can I accomplish this?

myTypeahead= $('#txtBox').typeahead({
            name: 'typeahead',
            valueKey: "Value",
            remote: 'serviceHander.ashx',
            template: ['<p>{{Value}}</p>'],
            engine: Hogan,
        });
Share Improve this question asked Jun 3, 2013 at 14:05 Barry TormeyBarry Tormey 3,1265 gold badges37 silver badges56 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 11

Selected suggestion gets the class .tt-cursor.

.tt-cursor{
    color:#f1b218;
}

Found the answer.

Turns out that my CSS properties were getting inherited and I had to set the .tt-is-under-cursor explicitly like so:

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

UPDATE

The class has been renamed to .tt-cursor

Example:

.tt-cursor {
    background-color: #000000!important;
    color: #FFFFFF !important;
}
发布评论

评论列表(0)

  1. 暂无评论