GlobalEventHandlers.onpointermove

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2020.

一个global event handler(全局事件) pointermove 事件。

语法

var moveHandler = targetElement.onpointermove;

返回值

moveHandler

返回 targetElement 元素的 pointermove 事件处理函数。

示例

下面展示了两种设置元素 pointermove 事件处理函数的方法。

js
<html>
<script>
function moveHandler(ev) {
 // 此处添加事件处理语句
}
function init() {
 var el=document.getElementById("target1");
 el.onpointermove = moveHandler;
}
</script>
<body onload="init();">
<div id="target1"> Touch me ... </div>
<div id="target2" onpointermove="moveHandler(event)"> Touch me ... </div>
</body>
</html>

规范

Specification
Pointer Events
# the-pointermove-event
Pointer Events
# dom-globaleventhandlers-onpointermove

浏览器兼容性

BCD tables only load in the browser

参见