jay*_*alk 5 iframe mobile mobile-safari stoppropagation reactjs
我试图将按钮绝对放置在iframe上。但是,当在移动网络中查看我的应用程序时,不会记录任何按钮单击;相反,点击会在其下方的 iframe 上注册。
完全相同的实现也适用于非移动网络。

这是我当前使用的代码:
<div style={{ width: '100vw', height: '100vh', display: 'flex', position: 'relative' }} />
<button
style={{ position: 'absolute', top: 0, bottom: 0, zIndex: 1 }}
onClick={() => console.log('button clicked')}
>
click here
</button>
<iframe style={{ width: '100%' }} src={src} />
</div>
Run Code Online (Sandbox Code Playgroud)
我尝试过的其他一些事情:
z-index将的设置iframe为较低的数字(iframe仍然会被点击)pointer-events按钮iframe点击仍未注册)button在一个diviframe在一个divbutton| 归档时间: |
|
| 查看次数: |
457 次 |
| 最近记录: |