Skip to content

Instantly share code, notes, and snippets.

@akirchmyer
Created November 17, 2013 03:56
Show Gist options
  • Select an option

  • Save akirchmyer/7508904 to your computer and use it in GitHub Desktop.

Select an option

Save akirchmyer/7508904 to your computer and use it in GitHub Desktop.
A Pen by Andrew Kirchmyer.
//FastClick.attach(document.body);
button = document.createElement('button');
button.innerHTML="Test";
clickBox = document.createElement('input');
clickBox.type = "text";
touchendBox = document.createElement('input');
touchendBox.type = "text";
differenceBox = document.createElement('input');
differenceBox.type = "text";
$(button).on('click', function() {
clickBox.value = Date.now();
differenceBox.value = touchendBox.value - clickBox.value;
});
$(button).on('touchend', function() {
touchendBox.value = Date.now();
differenceBox.value = touchendBox.value - clickBox.value;
});
$(document.body).append(button);
$(document.body).append('click: ');
$(document.body).append(clickBox);
$(document.body).append('touchend: ');
$(document.body).append(touchendBox);
$(document.body).append('difference: ');
$(document.body).append(differenceBox);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment