質問

Is there a way of triggering mouseenter events on SVG elements that are behind other elements? It seems like the top element is catching the event and it is not bubbling up the DOM.

Alternatively, is there a good way of checking if the mouse is over a specific SVG element?

To clarify, I am trying to implement a 'drag & drop'-like functionality where i change the front element depending on the back one. Note that the elements are not nested.

役に立ちましたか?

解決

I just found the answer. The trick is to set pointer-events: none for the element when you start the drag (on mousedown) and then back to pointer-events: all when you finish dragging. That way the element doesn't capture any of the events, and lets them pass through to whatever is in the background.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top