html - 忽略 iframe 中的指针事件

标签 html css iframe

我希望有可能点击 iframe 内的链接,并能够在按钮附近执行任何鼠标操作,但仍在 iframe 内。

当我将 pointer-events: none; 添加到整个 iframe 并尝试通过将 pointer-events: all; 设置为按钮来忽略它时(我可以编辑iframe 源)它看起来仍然不接受此规则。

有没有人知道这是否可能? iframe 的大小必须更大,因为单击按钮后内容会发生变化,并且会出现按钮上方的元素。

这是链接:https://jsfiddle.net/fnv4vct6/2/

最佳答案

试试这个:

iframe {
  position: fixed;
  bottom: 0;
  right: 0;
  border: 1px solid #000;
  pointer-events: all;
  height: 400px;
}

iframe > * {
  pointer-events: none;
}

How can you make an iframe have pointer-events: none; but not on a div inside that?

关于html - 忽略 iframe 中的指针事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50390895/

相关文章:

html - 如何使用媒体查询更改 html 元素的顺序?

html - 在 Accordion 的两侧显示图像

javascript - 使图像淡入

html - div容器内div的自动宽度

javascript - 单击 div 内的 iFrame 时如何切换项目?

asp.net - 根据内容调整 iFrame 高度

javascript - 如果第一个 src 没有响应,请在 Iframe 中打开第二个 src?

php - 在 PHP 中提交表单时声音无法完成

javascript - 如何在for循环中添加事件监听器?

html - 我需要帮助在同一个 div 中对齐图像和链接