這是我的問題 - 我需要以某種方式訪問由更高z-index的另一元素覆蓋的項目的onclick。我知道這是違背Z指數的點,但任何想法?針對低z索引元素的Onclick用法
在下面的例子中,只有紅色小方塊的頂部可以點擊。我有一個網頁設計,其中需要點擊的選項卡被一個藝術性的酒吧所覆蓋...如果有一種方法(也許是一些JavaScript技巧?),我會喜歡使用onclick這些模糊的,較低的z-index元素改變任何定位,雖然我的直覺感覺不好。
<html>
<head>
<style type="text/css">
#bg {
position:absolute;
width:500px;
height:500px;
background:pink;
}
#under {
cursor:pointer;
margin-top:-10px;
background:red;
width:50px;
height:50px;
z-index:0;
}
#over {
position:absolute;
width:900px;
height:50px;
margin-top:10px;
z-index:100;
}
</style>
</head>
<body>
<div id="bg">
<div id="under" onclick="alert('hi');">aaa</div>
</div>
<div id="over"></div>
</body>
謝謝你給我答案。讓我們知道它是否有效。 – nottinhill 2010-09-25 19:13:02