A lot of the handlers for iPhone or Droid usually get triggered twice for both touch and mouse events. Often this will cause the algorithm to be run more than once when you may have only intended to run it once. When writing code I find it important to disable the default actions for mousedown and mouseup. Let's look at an example:
$document.bind('touchstart', function(e)
{ var someCapturedHandler = e.preventDefault; }
By capturing the handlers for mouseUp and mouseDown we can disable them and prevent the accidental execution of code when we meant to only run it once.
No comments:
Post a Comment