Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created April 12, 2011 15:28
Show Gist options
  • Save tmcw/915716 to your computer and use it in GitHub Desktop.
Save tmcw/915716 to your computer and use it in GitHub Desktop.
this.clearTimeout = function() {
if (this.clickTimeout != null) {
window.clearTimeout(this.clickTimeout);
this.clickTimeout = null;
return true;
} else {
return false;
}
};
$(this.parent).mousedown($.proxy(function(evt) {
if (this.clearTimeout()) { return; }
this.downEvent = evt;
$(this.parent).one('mouseup', $.proxy(function(evt) {
if (evt.pageY === this.downEvent.pageY &&
evt.pageX === this.downEvent.pageX) {
this.clickTimeout = window.setTimeout(
function() {
alert('single click');
// this.handleClick(evt)
}, 300);
}
}, this));
}, this));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment