Home » Html » Is it possible for the child of a div set to pointer-events: none to have pointer events?

Is it possible for the child of a div set to pointer-events: none to have pointer events?

Posted by: admin November 29, 2017 Leave a comment

Questions:

Is it possible for the child of a div set to pointer-events: none to have pointer events?

I need the div that holds another div to allow pointer events to pass through, but for the div itself to still have events.

Is this possible?

Answers:

Yes, it’s possible, and you basically just described how. Disable it for the parent and enable it for the child:


CSS:

.parent {
  pointer-events:none;        
}
.child {
    pointer-events:all;
}

HTML:

  <div class="parent">
    <a href="#">Parent</a>
    <div class="child">
      <a href="#">Child</a>        
    </div>
  ​</div>​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​

http://jsfiddle.net/4gQkT/