原文出处:https://blog.csdn.net/xtaydwxf1988/article/details/70308149
pointer-events: none 这句是关键
<style>
.container {
position: relative;
width: 200px;
height: 50px;
margin: 20px 0;
}
.cover_through {
pointer-events: none; //使用当前属性点击div将触发链接
}
.cover {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(255,203,152,0.5);
}
</style>
<div class="container">
<div class="cover_through cover js-click-to-alert"></div>
<a href="http://wx.huipinze.com" target="_blank">http://wx.huipinze.com</a>
</div>