This repository has been archived by the owner on May 24, 2021. It is now read-only.
forked from component/tap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
62 lines (56 loc) · 1.53 KB
/
test.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
<html>
<head>
<title>tap component</title>
<meta name="viewport" content="initial-scale=0.5; maximum-scale=0.5; user-scalable=0">
<style>
.box {
width: 400px;
height: 400px;
border: 1px solid #222;
color: #222;
text-align: center;
padding: 20px;
margin: 20px;
font-size: 44px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
</style>
</head>
<body>
<h1>tap component</h1>
<div class="tap box">tap to change color</div>
<div class="click box">
click to change color
<small>(notice it's much slower)</small>
</div>
<script src="../build/build.js" type="text/javascript"></script>
<script type="text/javascript">
var Tap = require('tap'),
tapbox = document.querySelector('.tap.box');
clickbox = document.querySelector('.click.box');
var tap = Tap(tapbox, function() {
tapbox.style.backgroundColor = randomColor();
});
clickbox.onclick = function() {
clickbox.style.backgroundColor = randomColor();
}
setTimeout(function() {
tapbox.innerHTML = 'no longer tappable!';
tap.unbind();
setTimeout(function() {
tapbox.innerHTML = 'tap to change color';
Tap(tapbox, function() {
tapbox.style.backgroundColor = randomColor();
});
}, 5000);
}, 5000);
function randomColor() {
return '#'+Math.floor(Math.random()*16777215).toString(16);
}
</script>
</body>
</html>