首页 > 其他 > 详细

在 iframe 上无法捕获 mousemove

时间:2021-09-11 21:18:08      阅读:27      评论:0      收藏:0      [点我收藏+]

在父级给 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

原文:https://www.cnblogs.com/7c89/p/15253420.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!