Currently I'm trying to implement touch support for an HTML element that should be draggable across a certain range. It's working on Android and iOS tablets using touchmove, but isn't working yet on IE 10 on a Windows tablet. I've managed to capture the MSPointerMove event, which I think should have a pageX and pageY property, but when I console.log
these, I get undefined
. Using the gesture events is not an option since I need to how exactly how far it has been dragged across an axis.
So, what properties should I look for?
Unfortunately, it appears my question did not include enough details to include the actual problem - the tablet I could test on can not access the internet, so I could not provide a JSFiddle to demonstrate the problem.
So the problem was that I'm using Angular, which uses a form of jQuery, which wraps events. Usually, this is great: instead of having to detect the particular implementation details of the current browser regarding an event object, jQuery sets the
pageX
andpageY
properties of the wrapper event object itself, so that you can always confidently access those properties.However: jQuery, at least in the version I'm using (1.10.2), does not yet know how to deal with
MSPointer
events (orpointer
events, used in IE11, for that matter). Thus, although I had a wrapper event object, there were nopageX
andpageY
properties.The workaround is to access
event.originalEvent
, i.e. the browser-specific event. Since this spec looks to be implemented by IE only anyway, it should be relatively safe to assume this object to be constructed the way IE constructs it, and access thepageX
andpageY
properties on that directly.