Is there any way to disable some DOM element from capturing mouse events?

tester picture tester · Nov 29, 2010 · Viewed 18.7k times · Source

I have an element which is on top of another element. I want to capture the mouseover event with the bottom element, but when the mouse cursor is over the top element the bottom element is not receiving the mouseover events.

Is there any way to disable the top element from receiving mouse events?

Answer

Ryan Rapp picture Ryan Rapp · May 4, 2012

Elements can be easily disabled from receiving mouse events using, in your example, the following CSS:

#region2 {
    pointer-events: none;
}

For more discussion, see this SO post.