-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
72 lines (69 loc) · 2.77 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="node_modules/goodcore/goodcore.bundle.js"></script>
<!-- <script src="https://unpkg.com/goodtap"></script> -->
<script src="dist/lib/goodtap.bundle.js"></script>
<style>
html,
body {
margin: 0;
width: 100%;
height: 100%;
}
.selected {
background-color: lightblue;
}
</style>
</head>
<div id="o1" class="outer" tap="alert(this.id);">
outer clickable
<div id="i1" class="inner" tap="alert(this.id);">
clickable
</div>
<div id="i2" class="inner">
not clickable
</div>
<div id="i3" class="inner" stopPropagation tap="alert(this.id);">
clickable stops propagation
</div>
<input id="t1">Normal textbox</input>
<input id="t1" tap="return false;">Capturing textbox</input>
<div id="m1" stopPropagation down="this.m = goodcore.Timer.now();" up="alert(goodcore.Timer.now() - this.m);">mouse down/up</div>
<div id="i4" class="inner" stopPropagation press="console.log('PRESSED');">
Long Press every 500ms
</div>
<div id="i4" class="inner" once pressInterval="300" stopPropagation press="console.log('300ms long press');">
Long Press after 300ms, only once
</div>
<div id="i4" style="height: 200px; background-color:lightpink" class="inner" stopPropagation swipe="alert('swipe ' + (touch.swipeInfo.direction));">
Swipe here
</div>
<div id="select1" class="inner" outside="this.classList.remove('selected'); console.log(this.id + ' unselected')" stopPropagation
tap="this.classList.add('selected'); console.log(this.id + ' selected')">
select me
</div>
<div id="select2" class="inner" outside="this.classList.remove('selected'); console.log(this.id + ' unselected')" stopPropagation
tap="this.classList.add('selected'); console.log(this.id + ' selected')">
no, select me
</div>
</div>
<div id="drag" class="outer" noTouchScroll drag="document.getElementById('pos').innerText = JSON.stringify({x: touch.pos.x, y: touch.pos.y});" style="height: 200px; width: 100%; background-color:lightpink">
start dragging here <span id="pos"></span>
<div id="drag2" class="inner" draggable restrict="drag,y" style="position: relative; height: 100px; width: 150px; background-color:hotpink">
<div noTouchScroll drag dragTarget="drag2" gt-false style="height: 30px; background-color: skyblue;"> drag handle </div>
</div>
</div>
<script>
window.tap = goodtap.init();
tap.on(document.getElementById("drag") ,"dragstart", (ev, target, touch) => {
touch.absorigin = new goodcore.Vec2(target.offsetLeft, target.offsetTop);
});
tap.on(document.getElementById("drag") ,"dragend", () => document.getElementById("pos").innerText = "");
</script>
<body>
</body>
</html>