日期:2014-05-17  浏览次数:22921 次

在firefox中,设置div的position为absolute的时候,被其遮住的连接无法点击
如:
<div style=" position:absolute;width:973px; height:97px; left:50%; margin-left:-486px;top:0px; z-index:1;"></div>
<table width="1003" height="98" border="0" align="center" cellpadding="0" cellspacing="0">
<tr><td><a href="http://www.touch-ok.cn"><img src="logo_touch" height="80" width="150"></a></td></tr></table>


这时,firefox上,img的连接点不了,其他浏览器可以。请高手赐教,在线等,解决马上结贴。

------解决方案--------------------
好像只有IE可以点吧…………
IE中不设置背景色的元素遮住其他元素后,其他元素还可以响应事件,但是在Firefox/Chrome/Safari中是不可以的。
可以提高table的层叠级别,使table覆盖div。
<div style=" position:absolute; width:973px; height:97px; left:50%; margin-left:-486px;top:0px;border:1px solid red; z-index:1;"></div>
<table width="1003" height="98" border="0" align="center" cellpadding="0" cellspacing="0" style="position:relative; z-index:2;">
<tr>
<td><a href="http://www.touch-ok.cn"><img src="logo_touch" height="80" width="150"></a></td>
</tr>
</table>

详细的分析,可以看看这篇文章:http://www.w3help.org/zh-cn/causes/BT9029

------解决方案--------------------
斑竹回答的不靠谱,给浮动流中的div加SVG样式'pointer-events: none;'就可以了,基本都支持,除了IE。正好IE本来透明的div就能点到下边的东西,搞定。等着接分。