Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我有两个元素,一个在另一个之上,我能否识别这两个元素的点击事件?我一直在寻找stackoverflow并找到pointer-events:none了,但这会将指针事件传递给下面的元素,而我两者都想要。
pointer-events:none
您可以让顶部元素触发底部元素
HTML
<div class="a"> <div class="b">
CSS
.a { position: absolute; } .b { position: absolute; z-index: 10; }
jQuery
$('.a').click(function(){ ... }); $('.b').click(function(){ $('.a').click(); ... });