UPDATE這似乎不再是最新的FX/Chrome瀏覽器使用邊緣問題的jQueryTokenInput加上jQuery UI的對話框衝突
問題:自動完成將是對話的背後,如果你移動它,該對話框將移動到頁面之外。
調查
我已經檢查
Why does jquery ui dialog mangle my jquery.tokeninput.js autocomplete?
而且閱讀github上要求
- 問題93 Result list doesn't display properly when in jQuery-ui modal dialog和
- 問題94 Dropdown positioning issues
但我仍然有同樣的問題,我認爲是最新的一切(TokenInput JS和CSS從github jQuery TokenInput)。
DEMOS和代碼
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/base/jquery-ui.css" type="text/css" />
<script type="text/javascript" src="jquery.tokeninput.js"></script>
<link rel="stylesheet" href="token-input-facebook.css" type="text/css" />
<button id="filterBut">FILTER</button>
<div id="dialog-form" title="Filter" style="border:1px solid black">
<p class="validateTips">Enter text contained in the respective fields</p>
<form>
<fieldset>
<label for="name">Field1</label><br/><input type="text" name="Flt1" id="Flt1" class="text ui-widget-content ui-corner-all" style="width:300px"/><br/><br/>
<label for="email">Field2</label><br/><input type="text" name="Flt2" id="Flt2" value="" class="text ui-widget-content ui-corner-all" style="width:300px" />
</fieldset>
</form>
</div>
<script>
$(function() {
$("#Flt1, #Flt2").tokenInput([
{id: 7, name: "Ruby"},
{id: 11, name: "Python"},
{id: 13, name: "JavaScript"},
{id: 17, name: "ActionScript"},
{id: 19, name: "Scheme"},
{id: 23, name: "Lisp"},
{id: 29, name: "C#"},
{id: 31, name: "Fortran"},
{id: 37, name: "Visual Basic"},
{id: 41, name: "C"},
{id: 43, name: "C++"},
{id: 47, name: "Java"}
],{theme:"facebook"});
$("#dialog-form").dialog({
autoOpen: false,
height: 400,
width: 460,
modal: true
});
$("#filterBut").click(function() {
// suggestion from
// https://stackoverflow.com/questions/6669654/why-does-jquery-ui-dialog-mangle-my-jquery-tokeninput-js-autocomplete
$("#dialog-form script").remove();
// does not seem to change anything
$("#dialog-form").dialog("open");
});
});
</script>
</div>
</div>
</form>
正如你所看到的,我已經籤問題94 – mplungjan
對不起,我錯過了。 –
問題#94的補丁文件修復了不顯示下拉菜單的問題。但是,它會在ui對話框中顯示一個垂直滾動條。 –