Basic polyfill for Pointer Events W3C Specitication using jQuery special events API.
Polyfill is trying to dynamically wrap all the possible mouse*
, touch*
and MSPointer*
events to provide a single PointerEvent
Interface. Read more.
Because there are too many different events types on different platforms with different input mechanisms. Read more.
$ 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>
pointerenter
pointerover
pointerdown
pointermove
pointerup
pointerout
pointerleave
pointercancel
gotpointercapture
lostpointercapture
element.setPointerCapture()
element.releasePointerCapture()
onpointer*
HTML attributestouch-action
CSS propertywindow.navigator.pointerEnabled
window.maxTouchPoints
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;
}
- open
test/index.html
in your browser(s), do something and look at console output npm test