Home > Web Front-end > CSS Tutorial > How to Emulate `pointer-events: none` in Internet Explorer?

How to Emulate `pointer-events: none` in Internet Explorer?

Mary-Kate Olsen
Release: 2024-11-16 08:10:03
Original
872 people have browsed it

How to Emulate `pointer-events: none` in Internet Explorer?

Emulating Pointer-Events: none in Internet Explorer

In a project involving the enhancement of Highcharts, a need arose to display a gradient PNG over the charts. Utilizing the CSS property pointer-events: none would allow users to interact with the chart despite the overlaying div. However, this property is not recognized by Internet Explorer.

How to Enable Pointer-Event-Like Functionality in IE?

While pointer-events: none is not directly supported in Internet Explorer, the browser does support pointer events for SVG elements, as specified by the W3C. This means that you can use SVG elements to achieve similar functionality:

#tryToClickMe {
  pointer-events: none;
  width: 400px;
  height: 400px;
  background-color: red;
}
Copy after login
<svg>
Copy after login

With this approach, mouse events will pass through the SVG element to the underlying elements. You can further enhance this functionality by wrapping existing elements within an SVG using the jQuery wrap() method.

Alternative Solution for Accessing Overlying and Underlying Objects

If you need to access both overlying and underlying objects, you can utilize the document.msElementsFromPoint method available in IE. This method returns an array of all layers on a given point, enabling you to interact with both accessible elements.

The above is the detailed content of How to Emulate `pointer-events: none` in Internet Explorer?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template