Index: sky/examples/touch-demo.sky |
diff --git a/sky/examples/touch-demo.sky b/sky/examples/touch-demo.sky |
new file mode 100644 |
index 0000000000000000000000000000000000000000..26c659bc2a5ddd9401ac116d76efbbb2c440668c |
--- /dev/null |
+++ b/sky/examples/touch-demo.sky |
@@ -0,0 +1,16 @@ |
+<sky> |
+<div id="log">Ready</div> |
+<script> |
+function logTouchEvent(evt) { |
+ var message = "type=" + event.type; |
+ if (evt.touches && evt.touches.length > 0) |
+ message += " x=" + evt.touches[0].clientX + " y=" + evt.touches[0].clientY; |
+ document.getElementById("log").textContent = message; |
+} |
+ |
+document.documentElement.addEventListener("touchstart", logTouchEvent); |
+document.documentElement.addEventListener("touchmove", logTouchEvent); |
+document.documentElement.addEventListener("touchend", logTouchEvent); |
+document.documentElement.addEventListener("touchcancel", logTouchEvent); |
+</script> |
+</sky> |