Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Mobblestouch — W3C Touch Events and gestures
Search
Kornel Lesiński
October 25, 2011
Technology
2
730
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
Share
More Decks by Kornel Lesiński
See All by Kornel Lesiński
SudWeb
kornel
0
210
Lossy PNG for true-color images (Velocity Conf EU 2014)
kornel
2
900
Modern PNG compressors
kornel
13
1.2k
Handling binary data in JS
kornel
1
400
Server-Sent Events
kornel
5
980
"HTML5" Transport Protocol
kornel
3
400
Front-end Performance
kornel
5
500
Other Decks in Technology
See All in Technology
チームで安全にClaude Codeを利用するためのプラクティス / team-claude-code-practices
tomoki10
7
3.4k
Vivre en Bitcoin : le tutoriel que votre banquier ne veut pas que vous voyiez
rlifchitz
0
310
SwiftDataを覗き見る
akidon0000
0
280
Oracle Database@Azure:サービス概要のご紹介
oracle4engineer
PRO
3
390
プロンプトエンジニアリングを超えて:自由と統制のあいだでつくる Platform × Context Engineering
yuriemori
0
460
あの夜、私たちは「人間」に戻った。 ── 災害ユートピア、贈与、そしてアジャイルの再構築 / 20260108 Hiromitsu Akiba
shift_evolve
PRO
0
750
これまでのネットワーク運用を変えるかもしれないアプデをおさらい
hatahata021
4
220
AWS Network Firewall Proxyで脱Squid運用⁈
nnydtmg
1
110
CQRS/ESになぜアクターモデルが必要なのか
j5ik2o
0
1.3k
旬のブリと旬の技術で楽しむ AI エージェント設計開発レシピ
chack411
1
290
クラウドセキュリティの進化 — AWSの20年を振り返る
kei4eva4
0
130
産業的変化も組織的変化も乗り越えられるチームへの成長 〜チームの変化から見出す明るい未来〜
kakehashi
PRO
1
810
Featured
See All Featured
The agentic SEO stack - context over prompts
schlessera
0
590
What does AI have to do with Human Rights?
axbom
PRO
0
1.9k
Skip the Path - Find Your Career Trail
mkilby
0
44
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
99
[SF Ruby Conf 2025] Rails X
palkan
0
710
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
1
360
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.1k
The Cost Of JavaScript in 2023
addyosmani
55
9.4k
Everyday Curiosity
cassininazir
0
120
The Limits of Empathy - UXLibs8
cassininazir
1
200
My Coaching Mixtape
mlcsv
0
26
Transcript
Mobblestouch
www.w3.org/TR/touch-events
Microsoft http://blogs.msdn.com/b/ie/archive/2011/10/19/ handling-multi-touch-and-mouse-input-in-all-browsers.aspx
mousedown = mousemove = mouseup = touchstart touchmove touchend
mouseover mouseout :hover
click
element.ontouchstart = function(event){…} element.addEventListener (‘touchstart’,…,…)
TouchEvent interface event.touches = […] event.chagedTouches = […]
TouchEvent interface event.pageX → event.touches[i].pageX event.target → event.touches[i].target event.targetTouches
Touch interface touch.pageY/touch.pageX touch.target touch.identifier
Div 1 Div 2 Div 3 mousedown mousemove mouseup
Div 1 Div 2 Div 3 touchstart touchmove touchend
Tap and… ontouchstart = function() { timer = setTimeout(hold, 1000)
} ontouchend = function() { clearTimeout(timer) if (!held) tap() } var timer; …hold!
Hold on! ontouchstart = function(e) { if (e.touches.length > 1)
return; clearTimeout(timer) timer = setTimeout(hold, 1000) e.preventDefault() }
call event.preventDefault()
body.ontouchmove = function(e) {e.preventDefault()}
:active trick body.ontouchmove = function(){}
gesturestart gestureend
1 2 Math.sqrt( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) )
Zoom moves!
Math.atan2( (x-x),(y-y) )
Math.TAU = 2*Math.PI Math.atan2(…)/Math.TAU*360+180
Beware of CSS transforms order!
Swipe Slow = peek Fast = switch
Swipe event.timestamp
Device ✌ ✌ 2.x ” 3.x ✌ ? Emulator ✌
” ” None
Alt Alt + Shift
Phantom limb vodori.com/blog/phantom-limb.html
@media all and (-moz-touch-enabled:1) {…} if (ontouchstart in window) {…}
document.body.ontouchstart = function() { touch_enabled = true; } Detection
Trackpad ≠ Multitouch MozSwipeGesture XUL only MozMousePixelScroll onscroll event.wheelDeltaX/Y
@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