我想设置选择菜单选项z-index。默认设置在顶部。
产生错误的步骤:点击选择菜单并将标签悬停。
<head>
<script type="text/javascript" src="jquery-1.8.3.js"></script>
<script type="text/javascript">
$(function() {
$('a').hover(function() {
$('div').show()
})
})
</script>
<style>
select option { position : relative; z-index : 5 }
</style>
</head>
<body>
<div style = "position:absolute; display none; background : #F00; width : 200px; height : 200px; z-index : 100000">new</div>
<select>
<option>jitender</option>
<option>chand</option>
<option>alok</option>
<option>srisvasta</option>
</select>
<a href = "#">hover</a>
</body>
答案 0 :(得分:2)
无法将选择弹出窗口置于另一个元素后面,但您可以使用$('select').blur()
模糊选择元素以在悬停后关闭选择。
答案 1 :(得分:0)
尝试以下代码:
$(function(){
$('a').hover(function(){
$('select').hide();
$('div').show()
})})