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 |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
pointermove event |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- Requires a vendor prefix or different name for use.
- Has more compatibility info.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.