-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
57 lines (43 loc) · 1.54 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!doctype html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Chrome Touch Emulation - Hongkiat.com</title>
<!-- jquery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="../_nav/js/jquery.js"><\/script>')</script>
<!-- demo scripts -->
<link rel="stylesheet" href="css/styles.css">
<script src="js/modernizr.js"></script>
<script src="js/hammer.js"></script>
<!-- nav script -->
<script src="../_nav/js/nav.js" type="text/javascript"></script>
</head>
<body>
<!-- nav script -->
<div class="demo-meta">
<h1 class="demo-title">Chrome Touch Emulation</h1>
<p class="demo-desc">This page demonstrates Touch Emulation. View this demo in Google Chrome, and enable the touch emulation to see the demo in action. Read further instruction in the demo.</p>
</div>
<!-- demo content -->
<div id="toucharea" class="demo-wrapper">
<p class="sidenote">View this page in Chrome and enable the Touch Event Emulation</p>
<div class="coord">
<div id="pagex">0px</div>
<div id="pagey">0px</div>
</div>
</div>
<script>
var obj = document.getElementById('toucharea');
obj.addEventListener('touchmove', function(event) {
if (event.targetTouches.length == 1) {
var touch = event.targetTouches[0];
var x = document.getElementById('pagex');
var y = document.getElementById('pagey');
x.textContent = touch.pageX + 'px';
y.textContent = touch.pageY + 'px';
}
}, false);
</script>
</body>
</html>