Created
May 20, 2011 14:42
-
-
Save digitarald/983049 to your computer and use it in GitHub Desktop.
Dragger.js static events
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
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' | |
}, | |
… |
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
# 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; | |
})(); |
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
# 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