GlobalEventHandlers.onpointerleave

就像在ElementWindow中点击类似,在某目标区域内,发生触点(鼠标指针,触摸等)行为时会触发源于pointerleave事件global event handler行为。 这个事件本身属于 Pointer Events API 的一部分。

语法

var leaveHandler = EventTarget.onpointerleave;

EventTarget.onpointerleave = leaveHandler;

返回值

leaveHandler
pointerleave 事件会执行EventListener 监听器会委托执行用以发送给目标。

样例

这个样例展示了两种使用 onpointerleave 来设置元素 pointerleave 事件处理器的方式。

<html>
<script>
function leaveHandler(ev) {
 // 执行 pointerleave event 事件
}
function init() {
 var el=document.getElementById("target1");
 el.onpointerleave = leaveHandler;
}
</script>
<body onload="init();">
<div id="target1"> Touch me ... </div>
<div id="target2" onpointerleave="leaveHandler(event)"> Touch me ... </div>
</body>
</html>

查看 Using Pointer Events 以了解更多详情。

规格

名称 状态 备注
Pointer Events – Level 2
onpointerleave
Working Draft Non-stable version
Pointer Events
onpointerleave
Recommendation Initial definition

浏览器支持情况

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome Full support 35Edge Full support YesFirefox Full support 59
Full support 59
Full support 29
Disabled
Disabled From version 29: this feature is behind the dom.w3c_pointer_events.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE Full support 11
Full support 11
Full support 10
Alternate Name
Alternate Name Uses the non-standard name: onmspointerleave
Opera ? Safari No support NoWebView Android Full support 37Chrome Android Full support 35Edge Mobile Full support YesFirefox Android Full support 29
Disabled
Full support 29
Disabled
Disabled From version 29: this feature is behind the dom.w3c_pointer_events.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
Opera Android ? Safari iOS No support NoSamsung Internet Android ?

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
User must explicitly enable this feature.
User must explicitly enable this feature.
Uses a non-standard name.
Uses a non-standard name.

参考

文档标签和贡献者

此页面的贡献者: ensleep
最后编辑者: ensleep,