I am using Hammer.JS to check events. I want to do something with a long press. So I am using hammers press event like this

var mc = new Hammer(can);

mc.on("press", function (ev) {

alert(ev.type);

});

From the documentation here http://hammerjs.github.io/recognizer-press/ I understood that you have to click and hold for 500 ms for the event to fire up but in my case it is firing always even if I just click it.

Any ideas why is it happening?

网友答案:

tried this on plunker (http://embed.plnkr.co/X7UOg0b8WkE8OREG3ixm/preview) and had no problems.

Try to change the "time" options with mc.get("press").set({time:500}).

What version of Hammerjs are you using? Perhaps an update will solve your issues?