-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathindex.html
58 lines (51 loc) · 1.68 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
<!doctype>
<html>
<head>
<title>long-press Test Page</title>
<script src="http://localhost:8080/src/long-press-event.js"></script>
<style>
.dock-item {
font-size: 14px;
font-family: arial;
display: inline-block;
margin: 10px;
padding: 10px;
border: 1px solid #ccc;
cursor: pointer;
width: 70px;
height: 70px;
border-radius: 3px;
text-align: center;
}
@keyframes jiggle {
0% {
transform: rotate(-1deg);
}
50% {
transform: rotate(1deg);
}
}
.dock-item[data-editing="true"] {
animation: jiggle 0.2s infinite;
border: 1px solid #aaa;
box-shadow: 0 0 1px rgba(0,0,0,.85);
}
</style>
<script>
window.onload = function() {
document.addEventListener('long-press', function(e) {
e.preventDefault();
e.target.setAttribute('data-editing', 'true');
});
document.addEventListener('click', function(e) {
console.log(e.type);
})
}
</script>
</head>
<body>
<div class="dock-item" data-long-press-delay="500">Press and hold me for .5s</div>
<div class="dock-item">Press and hold me for 1.5s</div>
<div class="dock-item" data-long-press-delay="5000">Press and hold me for 5s</div>
</body>
</html>