Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Mobblestouch — W3C Touch Events and gestures

Mobblestouch — W3C Touch Events and gestures

Presentation at Mr Mobbles Magical Emporium 10/2011

http://pornel.net/mobbles

Kornel Lesiński

October 25, 2011
Tweet

More Decks by Kornel Lesiński

Other Decks in Technology

Transcript

  1. Tap and… ontouchstart = function() { timer = setTimeout(hold, 1000)

    } ontouchend = function() { clearTimeout(timer) if (!held) tap() } var timer; …hold!
  2. Hold on! ontouchstart = function(e) { if (e.touches.length > 1)

    return; clearTimeout(timer) timer = setTimeout(hold, 1000) e.preventDefault() }
  3. @media all and (-moz-touch-enabled:1) {…} if (ontouchstart in window) {…}

    document.body.ontouchstart = function() { touch_enabled = true; } Detection
  4. @pornelski Image credits: Flickr—Vectorportal http://www.flickr.com/photos/ vectorportal, Flickr—Peter Kaminski http://flickr.com/people/peterkaminski, Denis-Carl

    http://www.deniscarl.com, Failblog.com and Dailysquee.com. Presented at: Mr Mobbles Magical Emporium 10/2011