Element:pointerover 事件
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.
The pointerover
event is fired when a pointing device is moved into an element's hit test boundaries.
语法
var overHandler = targetElement.onpointerover;
返回值
overHandler
-
pointerover 事件处理器返回目标元素的
overHandler.
案例
这里使用两种方式展示了如何去使用 onpointerover 去设置一个元素的 pointerover 事件处理器
js
<html>
<script>
function overHandler(ev) {
// Process the pointerover event
}
function init() {
var el=document.getElementById("target1");
el.onpointerover = overHandler;
}
</script>
<body onload="init();">
<div id="target1"> Touch me ... </div>
<div id="target2" onpointerover="overHandler(event)"> Touch me ... </div>
</body>
</html>
规范
Specification |
---|
Pointer Events # the-pointerover-event |
Pointer Events # dom-globaleventhandlers-onpointerover |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
pointerover 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.