• 周四. 4月 25th, 2024

5G编程聚合网

5G时代下一个聚合的编程学习网

热门标签

【转】在 iframe 上无法捕获 mousemove

admin

11月 28, 2021

转:https://blog.csdn.net/DongFuPanda/article/details/109533365

在父级给 document 添加 mousemove 时间,实现一个拖拽功能。当拖到 iframe 上方时,发现变得卡顿,开始还以为是代码要优化,后来发现是 iframe 搞的鬼。解决方法也很简单,在 mousedown 和 mouseup 给 iframe 添加个样式

function onMouseDown() {
	document.querySelector('iframe').style['pointer-events'] = 'none'
	// ...
}

function onMouseUp() {
	document.querySelector('iframe').style['pointer-events'] = 'auto'
	// ...
}

  

《【转】在 iframe 上无法捕获 mousemove》有2个想法

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注