Hammer Js - Off() Method Doesn't Work
I am using Hammer this way, it works (it just triggers next/prev buttons): var slider = document.getElementsByClassName('slider'); Hammer(slider[0]).on('swiperight', function() {
Solution 1:
Save the Hammer
instance to a variable. The following example removes pan
event after 5 seconds.
var h = newHammer(document);
h.on('pan', function(){
console.log('Panned');
});
setTimeout(function(){
console.log('removed');
h.off('pan');
}, 5000);
<scriptsrc="http://hammerjs.github.io/dist/hammer.min.js"></script>
Post a Comment for "Hammer Js - Off() Method Doesn't Work"