简体   繁体   English

如何强制jQuery UI Selectmenu出现在jQuery模式窗口的上方(即前面)?

[英]How do I force jQuery UI Selectmenu to appear above (i.e. in front of) a jQuery modal window?

I'm using jQuery UI Selectmenu to style a form's dropdowns. 我正在使用jQuery UI Selectmenu设置表单下拉菜单的样式。 I've created an example page of the form, so that you can see exactly what it is I am about to ask: 我创建了表单的示例页面,以便您可以确切地看到我要问的内容:

Test Page: jQuery UI Selectmenu 测试页:jQuery UI Selectmenu

As you'll see on the page that you arrive at after clicking the above example link, everything works fine with the main page's jQuery UI Selectmenu dropdowns (fields: "Page Dropdown 1" and "Page Dropdown 2"). 正如您在单击上面的示例链接后所到达的页面上所看到的那样,所有内容均可与主页的jQuery UI Selectmenu下拉菜单(字段:“ Page Dropdown 1”和“ Page Dropdown 2”)一起正常工作。 The problem that I have is that I cannot get the dropdowns to appear correctly on the modal window within the page. 我的问题是我无法使下拉菜单正确显示在页面内的模式窗口中。

Please click the above page's "Search" button to get to the modal window example. 请单击上一页的“搜索”按钮转到模态窗口示例。

The error is that the modal window's dropdowns (fields: "Modal Dropdown 1" and "Modal Dropdown 2") are appearing behind the modal window. 错误是模态窗口的下拉列表(字段:“模态下拉列表1”和“模态下拉列表2”)出现模态窗口的后面 You can see the bottom of them appear just under the modal window's bottom edge when you click on a dropdown. 单击下拉列表时,您可以看到它们的底部出现在模态窗口的底部边缘下方。 So my question is: 所以我的问题是:

How do I force jQuery UI Selectmenu to appear within (ie in front ) jQuery modal window and not behind it? 如何强制jQuery UI Selectmenu出现在jQuery模式窗口内(即前面 )而不是后面

I am using FancyBox to create the modal window with the following code: 我正在使用FancyBox使用以下代码创建模式窗口:

<a id="terminateEmployee_01" href="#terminateEmployeeShortcut">
<img src="/search/img/buttons/search_out.gif" width="200" height="34" class="rollover">
</a>

Here is the code that defines the modal window's dropdown styling: 这是定义模式窗口的下拉样式的代码:

<script type="text/javascript">
<!--
$(document).ready(function() {
// Dropdown Width Definitions
$('select#modalDD01').selectmenu({
    style:'dropdown',
    width: 200,
    maxHeight: 238
});

$('select#modalDD02').selectmenu({
    style:'dropdown',
    width: 200,
    maxHeight: 238
});
});
// -->
</script>

And here is the code that creates the DIV in which the modal window lives: 以下是创建DIV的代码,模态窗口位于其中:

<div style="display: none;">
<div id="terminateEmployeeShortcut" style="width:470px;height:165px;overflow:auto;">
<table width="460" cellspacing="0"> 
<tr>
<td class="bodyLabel" width="220">Modal Dropdown 1</td>
<td width="20"></td>
<td class="bodyLabel" width="220">Modal Dropdown 2</td>
</tr>

<tr>
<td width="220">
    <fieldset>
    <select name="modalDD01" id="modalDD01" tabindex="20" />
    <option value="" selected="">&nbsp;</option>
    <option value="One">One</option>
    <option value="Two">Two</option>
    <option value="Three">Three</option>
    <option value="Four">Four</option>
    <option value="Five">Five</option>
    </select>
    </fieldset>
</td>
<td width="20"></td>
<td width="220">
    <fieldset>
    <select name="modalDD02" id="modalDD02" tabindex="20" />
    <option value="" selected="">&nbsp;</option>
    <option value="One">One</option>
    <option value="Two">Two</option>
    <option value="Three">Three</option>
    <option value="Four">Four</option>
    <option value="Five">Five</option>
    </select>
    </fieldset>
</td>
</tr>
</table>

<br clear="left"><img src="/search/img/misc/spacer.gif" height="26" width="32"><br clear="left">
<a href="javascript:void(0);"><img src="/search/img/buttons/save_pop_out.gif" width="200" height="34" class="rollover"></a></center>

</div>
</div>

Again, though, perhaps seeing it in action is most helpful: 再说一次,也许在实际操作中看到它最有帮助:

Test Page: jQuery UI Selectmenu 测试页:jQuery UI Selectmenu

Perhaps I can add something to it that will make it appear on top of everything else on the page? 也许我可以添加一些内容,使其显示在页面上的所有其他内容之上?

Please let me know what else I can provide for some help with this. 请让我知道在此方面我还能提供什么帮助。 Thank you so much in advance! 提前非常感谢您!

我从firebug中检查了您的代码,您需要更改ID为“ modalDD01-menu”和“ modalDD02-menu”的ul属性,为每个ul样式添加z-index:9999

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM