-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlockbox.html
92 lines (72 loc) · 1.72 KB
/
lockbox.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<html>
<head>
<title>Javascript Functions</title>
<style type="text/css">
.spacer {
height: 500px;
}
.box {
display: none;
height: 100px;
width: 100px;
background-color: #ff0000;
}
img {
width: 100px;
position: absolute;
}
</style>
</head>
<body>
<label>Clicks: 0</label>
<div id="elevator">
<button class="down" href="#">
Down
</button>
<div class="elevator">
<img src="http://upload.wikimedia.org/wikipedia/commons/3/3e/Elevator_icon.png"/>
</div>
</div>
<div class="spacer">
</div>
<div id="box">
<div class="box">
<button class="up" href="#">
Up
</button>
<button class="close-box" href="#">
Close the Box
</button>
</div>
<button class="open-box" href="#">
Open the Box
</button>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
$('.down').on('click', function () {
$('img').animate({top: "+=400px"}, 3000)
});
$('.open-box').on('click', function (e) {
e.preventDefault();
$(".box").show();
});
$('.up').on('click', function () {
$('img').animate({top: "-=300px"}, 3000)
});
$(".close-box").on("click", function (e) {
$(".box").hide();
});
var counter = 0;
$("body").on("click", function (e) {
counter += 1;
$("label").text('Clicks: ' + counter);
});
// $(document).on('new-click-count', function (e){
// if (counter % 5 === 0) {
// alert("New High Score: " + counter + "!");
// });
// $(document).trigger('new-click-count', counter);
</script>
</body>
</html>