Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 body 上附加了一个事件。但是弹出窗口后面的主体上会出现一个透明的 Iframe。我想在 body 上调用 mousemove 事件,以便在 iframe 上发生 mousemove 时弹出窗口消失。
我以前遇到过这个问题。当您添加 an 时会发生什么iframe,body通常会发送到 body 的事件(如 mousemove)被该 iframe 阻止。
iframe
body
div每当弹出窗口打开时,我通过在 iframe 上添加 100% 高度和宽度的绝对定位来解决此问题。这div应该具有更高的 z-index 作为iframe.
div
而不是听鼠标移动body你可以然后听div。div每当您关闭弹出窗口时删除。