I have an iframe with an inherited pointer-events: none;
but when I have inserted a <div>
inside the iframe with a pointer-events: auto;
the div won't react to clicks or any mouse hover events.
The reason for this is that the iframe
is inside a <div style="position:fixed;">
so it is kind of like a little menu. But I would like the user to click through the iframe
, but not through the links and divs in the iframe.
And yes, it absolutely needs to remain an iframe.
How could I bypass this? Can I even bypass this?
Here's a simple example: jsfiddle.net/MarcGuiselin/yLo119sw/2
Edit 2023:
Geez, time sure does fly by haha. What I wanted to do originally can now be achieved via the shadow dom. (Supported in 97% of browsers)
This allows chrome extensions or scripts to inject their css styles into a page, without accidentally changing the style of the website. For example, a chat support script like Zendenk, which injects it's own menu inside a website, must take care to not break the website itself:
PS: Zendesk technically uses an iframe since it's just a rectangular menu, but you get my point.