jquery-pointerevents
jquery-pointerevents copied to clipboard
Basic polyfill for Pointer Events W3C Specification
jQuery PointerEvents v0.5.2
Basic polyfill for Pointer Events W3C Specitication using jQuery special events API.
what?
Polyfill is trying to dynamically wrap all the possible mouse*
, touch*
and MSPointer*
events to provide a single PointerEvent
Interface. Read more.
why?
Because there are too many different events types on different platforms with different input mechanisms. Read more.
how?
$ bower install --save jquery-pointerevents
<!-- load jQuery and plugin as browser globals or with RequireJS/AMD -->
<script>
$('body').on({
pointerdown: function(e) { console.log(e); },
pointerup: function(e) { console.log(e); },
// …
});
</script>
implemented
-
pointerenter
-
pointerover
-
pointerdown
-
pointermove
-
pointerup
-
pointerout
-
pointerleave
-
pointercancel
not implemented
-
gotpointercapture
-
lostpointercapture
-
element.setPointerCapture()
-
element.releasePointerCapture()
-
onpointer*
HTML attributes -
touch-action
CSS property -
window.navigator.pointerEnabled
-
window.maxTouchPoints
cross-browser compatibility
Depends on your jQuery version – jquery.com/browser-support.
Also, caniuse.com/#feat=pointer:
// nothing to do in IE11 for today
if(win.navigator.pointerEnabled) {
return;
}
test
- open
test/index.html
in your browser(s), do something and look at console output -
npm test