Bagaimanakah Saya Boleh Mensimulasikan `pointer-events:none` dalam Internet Explorer?

Mary-Kate Olsen
Lepaskan: 2024-11-15 16:39:02
asal
877 orang telah melayarinya

How Can I Simulate `pointer-events:none` in Internet Explorer?

Emulating Pointer-Events:none in Internet Explorer

Internet Explorer's lack of recognition for the pointer-events:none; property can hinder users' ability to interact with layered elements. This issue arises when a gradient PNG is used over a chart, creating an overlaying div that obstructs user interaction. This article explores a solution that enables mouse events to pass through an element in IE, as if pointer-events:none; were being used.

Solution

Internet Explorer only recognizes pointer-events:none; for SVG elements, as per the W3C specification. To emulate this behavior for non-SVG elements, a viable solution is to wrap them within an SVG element.

CSS:

#tryToClickMe{
    pointer-events: none;
    width: 400px;
    height: 400px;
    background-color: red;
}
Salin selepas log masuk

HTML:

<svg>
Salin selepas log masuk

Alternatively, if you wish to access overlying and underlying objects, Internet Explorer provides the document.msElementsFromPoint method, which returns an array of all layers located at a specific point.

Conclusion

By utilizing these techniques, it is possible to achieve similar functionality to pointer-events:none; in Internet Explorer, allowing for improved user interaction despite layered elements.

Atas ialah kandungan terperinci Bagaimanakah Saya Boleh Mensimulasikan `pointer-events:none` dalam Internet Explorer?. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!

sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Artikel terbaru oleh pengarang
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan