1

I want to set select menu option z-index. By default it is set on top.

Step to produce bug: click on select menu and hover a tag.

enter image description here

<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>
4

2 回答 2

2

Placing the select popup behind another element is not possible, you can however blur the select element with $('select').blur() to close the select after hovering.

于 2013-05-21T11:29:23.670 回答
0

Try the code below:

$(function(){
 $('a').hover(function(){
 $('select').hide();
 $('div').show()
})})
于 2013-05-21T11:34:27.123 回答