Skip to content

Instantly share code, notes, and snippets.

@digitarald
Created May 20, 2011 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save digitarald/983049 to your computer and use it in GitHub Desktop.
Save digitarald/983049 to your computer and use it in GitHub Desktop.
Dragger.js static events
Dragger.prototype = {
// Use touch for supported devices, rest with mouse
eventNames: ('ontouchstart' in window) ? {
start: 'touchstart',
move: 'touchmove',
stop: 'touchend'
} : {
start: 'mousedown',
move: 'mousemove',
stop: 'mouseup'
},
# Class Container
class App.Container
# Use touch for supported devices, rest with mouse
if 'ontouchstart' of window
@eventNames:
start: 'touchstart', move: 'touchmove', stop: 'touchend'
else
@eventNames:
start: 'mousedown', move: 'mousemove', stop: 'mouseup'
---
App.Container = (function() {
function Container() {}
if ('ontouchstart' in window) {
Container.eventNames = {
start: 'touchstart',
move: 'touchmove',
stop: 'touchend'
};
} else {
Container.eventNames = {
start: 'mousedown',
move: 'mousemove',
stop: 'mouseup'
};
}
return Container;
})();
# Class Container
class App.Container
# Use touch for supported devices, rest with mouse
@eventNames: if 'ontouchstart' of window
start: 'touchstart', move: 'touchmove', stop: 'touchend'
else
start: 'mousedown', move: 'mousemove', stop: 'mouseup'
----
App.Container = (function() {
function Container() {}
Container.eventNames = 'ontouchstart' in window ? (Container.prototype.start = 'touchstart', Container.prototype.move = 'touchmove', Container.prototype.stop = 'touchend') : (Container.prototype.start = 'mousedown', Container.prototype.move = 'mousemove', Container.prototype.stop = 'mouseup');
return Container;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment