2015-11-06 23 views
6

Sembra che il CSS non funzioni per il mio Typeahead. Sto cercando di riprodurre il menu a discesa scorrevole come su https://twitter.github.io/typeahead.js/examplesTypeahead - menu a discesa scorrevole.

Ecco il mio codice:

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; 
     } 

non riesco a vedere dove la .tt-dropdown-menu è?

Cheers,

Mick

risposta

11

Vedi questo GitHub issue. C'è un problema con l'esempio del dropdown scorrevole.

Aggiornare il CSS a:

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