.tt-suggestion.tt-cursor的颜色无法更改

时间:2015-04-22 13:43:34

标签: typeahead.js

我必须更改.tt-suggestion.tt-cursor字体的颜色并删除它的背景。

以下CSS不起作用:

.tt-suggestion.tt-cursor {
   color: #009bc6;
}

2 个答案:

答案 0 :(得分:0)

  

<强>原因

在预先版本0.11中已更改此内容,将鼠标悬停在.tt-suggestion元素上不再触发.tt-cursor课程,请参阅this issue #1195

  

<强>解

// WORKAROUND: Add support for tt-cursor style on mouseenter/mouseleave
$('.twitter-typeahead')
   .on('mouseenter', '.tt-suggestion', function(e){
      $('.tt-cursor', $(this).closest('.tt-menu')).removeClass('tt-cursor');
      $(this).addClass('tt-cursor');
   })                  
   .on('mouseleave', '.tt-menu', function(e){
      $('.tt-cursor', $(this).closest('.tt-menu')).removeClass('tt-cursor');
   });

答案 1 :(得分:0)

根据contributor

  是的,这是故意的。这样做是为了清楚地表明,悬停在一个建议上并且对它的关键是不同的。例如,后者将改变输入中的显示值,而前者则不会。

请参阅此issue

您可以像这样设置样式:

.tt-suggestion.tt-cursor, 
.tt-suggestion:hover {
    // property: value;
}