question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The browser that supports pointer event, The Hammer doesn't work.

See original GitHub issue

Chrome has began supporting PointerEvent since version 55. If you don’t set inputType on Hammer.manager, Hammer use Pointer Event as a InputType.

But, Hammer.js has bug about Pointer Event. The Hammer doesn’t work anything.

related issues

#1082, #1071, #1068, #1067, #1065, #1058, #1056, #1054, #1048

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

19reactions
Finessecommented, Oct 20, 2019

Here is an easy-peasy solution (no need to modify the library code):

const hammer = new Hammer(
  document.getElementById('gesture-element'),
  { inputClass: Hammer.TouchMouseInput } // Does the trick
);
hammer.on('swipe', event => {
  console.log('Swipe works');
});

I tested in with Hammer 2.0.8 on Chrome (Mac), Safari (Mac and iOS 13) and iOS 13 webview.

3reactions
grumpygarycommented, Nov 29, 2017

You can add the following code to the end of the assign(hammer, { … section in v2.0.8 (at the end):

    ,supportPointerEvents(arg) { 
        return SUPPORT_POINTER_EVENTS = arg !== false && prefixed(window, 'PointerEvent') !== undefined; 
    }

Then, call Hammer.supportPointerEvents(false); on app startup (before adding instantiating items). This will effectively turn the pointer-events processing off; and make many of these problem go away (for now anyway).

Read more comments on GitHub >

github_iconTop Results From Across the Web

372357 - Scrolling broken due to touch-action support on sites ...
Issue 372357: Scrolling broken due to touch-action support on sites using hammer.js library (eg. currys.co.uk). Reported by schedule owale@chromium.org owale ...
Read more >
Dragging an element with hammer.js fails on mobile
In a desktop browser it works, but on mobile when I start dragging it works briefly, then suddenly acts as if the event's...
Read more >
API - Hammer.js
Unbinds all events and input events and makes the manager unusable. It does NOT unbind any domEvent listeners. Hammer.Recognizer. Every Recognizer extends from ......
Read more >
CSS pointer-events (for HTML) | Can I use... Support tables for ...
This CSS property, when set to "none" allows elements to not receive hover/click events, instead the event will occur on anything behind it....
Read more >
Gestures in an Angular Application - InDepth.Dev
ts file you will see an error within the console that will stop your application from running. <>Copy. Error: Hammer.js is not loaded,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found