-
Notifications
You must be signed in to change notification settings - Fork 0
Input.js
dannyx0 edited this page Aug 10, 2012
·
2 revisions
Input.js captures three basic input events (touchstart/mousedown, touchmove/mousemove, touchend/mouseup) and provides simple function hooks. Each function passes two parameters, average (an averaged x/y object) and inputs (an array of all inputs).
element [dom] - DOM element to track input on.
preventDefault [bool] - Should default event behavior be prevented?
<div id="target"></div>require(["Input"], function (input) {
input.init({
element : document.getElementById('target'),
preventDefault : true
});
input.ontapstart = function (average) {
console.log(average.x, average.y);
};
input.ontapmove = function (average) {
console.log(average.x, average.y);
};
input.ontapend = function (average) {
console.log(average.x, average.y);
};
});