Slide 407
Slide 407 text
myButton.addEventListener('touchstart', addHighlight, false);
myButton.addEventListener('touchend', removeHighlight, false);
myButton.addEventListener('mousedown', addHighlight, false);
myButton.addEventListener('mouseup', removeHighlight, false);
myButton.addEventListener('click', someFunction, false);
/* addHighlight/removeHighlight will fire twice for touch
(first for touch, then for mouse compatibility events);
can't use e.preventDefault(), as we want to rely on 'click' */