我有以下的标记:是否可以抑制父进程:活动伪类?
<div class="parent">
I should change my color to green when clicked
<div class="element">I should do nothing when clicked</div>
</div>
下面是相关的CSS:
.parent {
width:200px;
height:200px;
background: red;
color: #fff;
}
.parent:active {
background:green;
}
.element {
background:blue;
}
有什么办法来防止触发.parent
的:active
伪类被点击.element
什么时候?尝试e.stopPropogation()
当.element
点击没有运气。 demo
我猜测jQuery'.stopPropogation()'对css渲染没有影响,只是在JavaScript事件上。 – 2013-03-20 12:40:05