我对css中的两个绝对元素有这样的问题
<div class="opacity" (click)="hideContext()">
<div class="context-menu-wrapper">
<div class="list-group">
<span (click)="goThere()" class=" list-group-item pl-25 pr-29">
<i class="icon-pencil "></i>1
</span>
<span (click)="goThere()" class=" list-group-item">
<i class="icon-pencil "></i>2
</span>
</div>
</div>
</div>
这里是两个元素的css
.opacity {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0,0,0,0.3);
z-index: 999999;
}
.context-menu-wrapper{
max-width:250px;
min-width: 250px;
pointer-events: none;
position: absolute;
left: 20px;
top: 50px;
}
当我点击一个函数时,它总是调用函数hideContext(),因为父函数是绝对的,子函数是绝对的