css3 pointer-events:auto;详解
<style type="text/css"> #div_grandfather{ height : 250px; background: orange; width:300px; border:1px solid; pointer-events:none; } #div_parent{ height:70%; background-color:#bbb; margin:30px; border: 1px solid; } #div_child{ height:70%; background-color:deepskyblue; margin:30px; pointer-events:auto; } </style> <body> <div id="div_grandfather" onclick="alert('grandfather')"> <div id="div_parent" onclick="alert('parent')"> <div id="div_child" > </div> </div> </div> </body>
pointer-events:none;是隐蔽事件的
pointer-events:auto; 是开启事件的(允许一层层查找有没有事件)
从内到外 里面可以覆盖外面的
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/18867.html