美文网首页
2019-04-08 记录一下用 onMouseDown 模拟

2019-04-08 记录一下用 onMouseDown 模拟

作者: 十月鹰飞 | 来源:发表于2019-04-08 13:35 被阅读0次

这个是模拟 ondarg 的万能用法

const onMouseDown = ( event ) = > {

const target = event.target;
document.onmousemove = (element) => {
  element.preventDefault();
  console.log('element', element);
};

target.onmouseup = () => {
  document.onmousemove = null;
  target.onmouseup = null;
};

}

相关文章

网友评论

      本文标题:2019-04-08 记录一下用 onMouseDown 模拟

      本文链接:https://www.haomeiwen.com/subject/dnpuiqtx.html