Last active
July 5, 2017 10:39
-
-
Save capynet/6282268f1bee60368912 to your computer and use it in GitHub Desktop.
Micro hammer.js adapter for jQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Download http://hammerjs.github.io/ | |
// jQuery plugin | |
(function ($) { | |
$.fn.mobileEvent = function (event, cb) { | |
this.length && (new Hammer(this.get(0)).on(event, $.proxy(cb, this))); | |
}; | |
})(jQuery); | |
// Usage | |
$('.some-element').mobileEvent('tap', function (e) { | |
console.log(e); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment