有没有办法点击元素,即使它在其他元素之上。我在一个 div 下有一个链接,该 div 必须在它所在的位置,但链接当然应该是可点击的。
解决方案?即使 jQuery 也可以,如果 CSS 不可能的话。
马蒂莱恩
编辑:我不能添加更高的链接,因为这里的 div 是一种覆盖/眩光。
有没有办法点击元素,即使它在其他元素之上。我在一个 div 下有一个链接,该 div 必须在它所在的位置,但链接当然应该是可点击的。
解决方案?即使 jQuery 也可以,如果 CSS 不可能的话。
马蒂莱恩
编辑:我不能添加更高的链接,因为这里的 div 是一种覆盖/眩光。
使用一些 Javascript,您可以添加另一个a
具有更高 z-index 的元素,并将其绝对定位在原始链接的位置上。
The only solution that will not result in hacking until the end of time is to either promote the link to a higher z-index or hide the div. Trying to track coordinates feels like an impossible solution.
Is there a reason you cannot promote the links to a higher stack index?
在通过单击传输鼠标坐标并确定 div 下的内容,然后向该元素发送单击之前,我已经完成了这种事情。但那只是几个可点击的项目。对于复杂的安排,我不想这样做。
添加此 CSS 规则
a {
z-index: 999; /* greater than top most div */
}