Home > Article > Web Front-end > How can I enable mouse pass-through in Internet Explorer for layered designs?
IE Emulation: Enabling Mouse Pass-Through with Pointer Events
Pointer events allow you to interact with underlying elements without being obstructed by overlying layers. While HTML5 defines pointer-events:none;, Internet Explorer does not recognize this property. This poses a challenge when working with layered designs, preventing IE users from accessing essential interactions.
Solution:
Internet Explorer supports pointer events only for SVG elements, as specified in the W3C specification. However, this limitation can be overcome by wrapping existing elements within an SVG.
Implementation:
CSS:
#tryToClickMe { pointer-events: none; width: 400px; height: 400px; background-color: red; }
HTML:
<svg>
This method mimics the behavior of pointer-events:none; in IE9 and IE10.
Additional Note:
To access underlying objects, IE provides the document.msElementsFromPoint method, which returns an array of all layers present at a given point. This technique allows you to interact with underlying elements even when they are obscured by overlying layers.
The above is the detailed content of How can I enable mouse pass-through in Internet Explorer for layered designs?. For more information, please follow other related articles on the PHP Chinese website!