I create an event using hammer.js library like this:
Hammer(myElement).on("doubletap", function(evt){
evt.preventDefault();
});
How can I then remove the registred event? Can I also use Jquery?
It's simply Hammer(myElement).off(eventName);
If you want to use jQuery, then the syntax is:
$(myElement).hammer().on(eventName, callback)
If you want to specify "namespace" for the event, then you declare eg.
$(myElement).hammer().on("tap.namespace", callback);
$(myElement).hammer().on("tap.anotherNamespace", callback2);
which makes it possible to detach only desired event, eg:
$(myElement).hammer().off("tap.anotherNamespace");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With