简体   繁体   English

将div置于活动选择框的顶部

[英]Position div ontop of active select box

I have a dropdown menu which I want to position ontop of everything else. 我有一个下拉菜单,我想把它放在其他一切的顶部。 However if I click on a select and then hover over my dropdown menu the select options appear ontop of the menu. 但是,如果我单击一个选择,然后将鼠标悬停在我的下拉菜单上,则会在菜单顶部显示选择选项。 How can I get the hovered menu to appear ontop of the select? 如何让悬停的菜单显示在选择的顶部?

在此输入图像描述

Sample code 示例代码

http://jsfiddle.net/b2vak/6/ http://jsfiddle.net/b2vak/6/

An easy fix would be to hide / show the select input on hover. 一个简单的解决方法是隐藏/显示悬停时的选择输入。 Like this: 像这样:

$("#menubar ul > li").hover(function() {
    $("#menu").show();
    $("select").hide();
}, function() {
    $("#menu").hide();
    $("select").show();
});

However I think this is not a very good solution, but the only one I can come up with :/ 不过我认为这不是一个很好的解决方案,但我能想出的唯一解决方案:/

A better solution is with an iframe in the background. 更好的解决方案是在后台使用iframe。 You can look at Stu Nicholls' example: http://www.cssplay.co.uk/menus/iframe-shim.html 你可以看看Stu Nicholls的例子: http//www.cssplay.co.uk/menus/iframe-shim.html

or just do a google search: http://www.google.at/search?q=css+selectbox+iframe and you will find plenty of examples. 或者只是进行谷歌搜索: http//www.google.at/search ?q = css +selectbox + iframe ,你会发现很多例子。

This is the only way, I know of, to do this cross browser. 我知道,这是跨浏览器的唯一方法。

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

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