2013-07-09 29 views
1

我已經使用滾動條顯示鍵入提示。但是當我移動keydown時,項目滾動條不移動,選定的項目不顯示。鍵入和鍵入的鍵入提示,滾動條不移動

這裏是JS

$("input").typeahead({ 
source: ["Alpha", "Alphabet", "Alfa", "Armadillo","ksdjflksdjfl","jksdjflsdjl","qi2ueouqwoei","jalhflasdf","pwoipa","ahweurw","qwipoqwieo"] 
}); 

這裏是CSS:

.typeahead.dropdown-menu { 
z-index: 100001; 
} 

    .modal-body { 
    overflow-y: visible 
    } 
    .typeahead { 
    max-height: 100px !important; 
    overflow-y: auto !important; 
    overflow-x: hidden !important; 
    padding-right: 20px !important; 
    } 

下面是HTML:

<div class='modal'> 
<div class='modal-body'> 
    Hello 
    <input /> 
</div> 
<div class='modal-footer'> 
    <button class='btn' data-toggle='modal'>Toggle</button> 
</div> 

這裏是小提琴http://jsfiddle.net/KAVx7/5/

如何解決這個問題。

+0

確實支持此功能嗎?因爲如果沒有,你將不得不爲此編寫單獨的代碼。這個特性在jquery tokeninput中也不存在,有人爲它寫了一個自定義代碼 –

+0

@ MandeepJain:我沒有發現任何關於typeahead支持滾動條的文檔。你能否給我提供爲jquery tokeninput編寫的自定義代碼的鏈接。 – Cindrella

+0

https://github.com/loopj/jquery-tokeninput/issues/130從底部尋找psiphiorg的解決方案。但恐怕它集成到插件中,所以你不能直接使用它 –

回答

0

下載最新版本0.9.3修復了我的問題。

0

Here討論了你的問題來看看並嘗試從rsteier評論的解決方案。

+0

實際上,單擊滾動條菜單隱藏在您提供的鏈接中。我已經通過鏈接並試圖使用該解決方案,但沒有用。但在我的情況下,菜單在滾動條被移動或移動時並不隱藏。在我的情況下,向下移動所選項目時,滾動條不會移動,因此建議結尾處的選定項目不會顯示。 – Cindrella