2015-11-06 40 views
6

看起來像CSS不能用於我的Typeahead。 我試圖重現滾動下拉菜單像 https://twitter.github.io/typeahead.js/examplesTypeahead - 可滾動下拉菜單

這裏是我的代碼:

JS

var productList = new Bloodhound({ 
      datumTokenizer: Bloodhound.tokenizers.obj.whitespace('PART_NO'), 
      queryTokenizer: Bloodhound.tokenizers.whitespace, 
      //Maybe I need a prefetch 
      // prefetch: '../data/films/post_1960.json', 
      remote: { 
       url: 'getProducts/%QUERY', 
       wildcard: '%QUERY' 
      } 
     }); 

     $('#scrollable-dropdown-menu .typeahead').typeahead(null, { 
      name: 'PARTS', 
      limit: 10, 
      display: 'PART_NO', 
      source: productList 
     }); 

CSS

#scrollable-dropdown-menu .tt-dropdown-menu { 
      max-height: 150px; 
      overflow-y: auto; 
      background-color: red; 
     } 

我看不到的地方.tt-dropdown-menu是?

乾杯,

米克

回答

11

看到這個GitHub issue。可滾動下拉示例有一個問題。

更新您的CSS來:

#scrollable-dropdown-menu .tt-menu { 
    max-height: 150px; 
    overflow-y: auto; 
    background-color: red; 
}