Skip to content

Commit 05eb04a

Browse files
authored
Update index.html
1 parent b10a842 commit 05eb04a

1 file changed

Lines changed: 42 additions & 10 deletions

File tree

adam/cookieclicker/index.html

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,57 @@
22
<html>
33
<head>
44
<link href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.css" rel="stylesheet">
5-
<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro|Source+Sans+Pro" rel="stylesheet">
5+
<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro|Source+Sans+Pro" rel="stylesheet">
66
<title>Cookie Clicker</title>
7-
<link href="../style.css" rel="stylesheet">
7+
<style>
8+
html {
9+
height: 100%;
10+
}
11+
.container {
12+
width: 80%;
13+
margin: 0 auto;
14+
text-align: center;
15+
}
16+
#cookieQuantity {
17+
font-size: 600%;
18+
}
19+
img#cookie {
20+
cursor: pointer;
21+
width: 100%;
22+
max-width: 640px;
23+
transition: width 0.05s;
24+
margin: 0 auto;
25+
}
26+
img#cookie:active {
27+
width: 98%;
28+
max-width: 630px;
29+
}
30+
</style>
31+
</head>
32+
<body>
33+
<div class="container">
34+
<p>You have<br><span id="cookieQuantity">0</span><br>cookies</p>
35+
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Pepperidge-Farm-Nantucket-Cookie.jpg/640px-Pepperidge-Farm-Nantucket-Cookie.jpg" alt="Cookie" id="cookie" onclick="cookieClick(); return false" />
36+
</div>
837
<script type="text/javascript">
9-
// Start with 0
38+
// Find the cookieQuantity field
39+
e_cookieQuantity = document.getElementById('cookieQuantity');
40+
41+
// Start with 0 cookies
1042
var cookies = 0;
1143

1244
// User clicks the giant cookie
1345
function cookieClick() {
46+
// They get a cookie
1447
cookies += 1;
48+
// Show them how many cookies they have
49+
displayCookies();
1550
}
1651

17-
// TODO: Display cookies
52+
// Display cookies
53+
function displayCookies() {
54+
e_cookieQuantity.innerHTML = cookies;
55+
}
1856
</script>
19-
</head>
20-
<body>
21-
<div class="container">
22-
<p>You have <span id="cookieQuantity">0</span> cookies</p>
23-
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Pepperidge-Farm-Nantucket-Cookie.jpg/640px-Pepperidge-Farm-Nantucket-Cookie.jpg" alt="Cookie" onclick="cookieClick(); return false" />
24-
</div>
2557
</body>
2658
</html>

0 commit comments

Comments
 (0)