-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
67 lines (66 loc) · 1.94 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Josefin+Sans:100" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Josefin+Sans:300" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/style.css">
<title></title>
</head>
<body>
<div class="body">
<div class="stick"></div>
<div class="box" style="left: 0;">
<div class="game"></div>
</div>
<div class="box" style="left: 140px;">
<div class="game"></div>
</div>
<div class="box" style="left: 280px;">
<div class="game"></div>
</div>
<div class="box" style="left: 420px;">
<div class="game"></div>
</div>
<div class="box" style="left: 560px;">
<div class="game"></div>
</div>
</div>
<div id="result"></div>
<button>play again</button>
<script type="text/javascript">
$(function(){
$('.game').click(function(){
$(this).html(Math.floor((Math.random() * 10) + 1));
var x = $('.number').length;
$(this).toggleClass('number');
$(this).attr('id', 'num' + x);
$(this).off();
$(this).css({
transition : '.5s',
transform : 'translateY(-20px)'
});
$(this).parent().css({
background: 'white',
transform : 'rotateX(360deg)',
transition: '.5s'
})
if (x === 2) {
var number1 = parseInt($('#num0').text(), 10);
var number2 = parseInt($('#num1').text(), 10);
var number3 = parseInt($('#num2').text(), 10);
$('#result').html(number1 + number2 + number3).slideToggle();
$('.game').off();
$('button').slideToggle(300);
}
$('button').click(function(){
location.reload();
})
})
})
</script>
</body>
</html>