Skip to content

Instantly share code, notes, and snippets.

@kimhogeling
Created September 22, 2018 08:59
Show Gist options
  • Save kimhogeling/59a8d11f65c3bea56dd9ce53160fa15b to your computer and use it in GitHub Desktop.
Save kimhogeling/59a8d11f65c3bea56dd9ce53160fa15b to your computer and use it in GitHub Desktop.
OTTO coding camp 2018
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
body {
background: grey;
}
button {
background: white;
border: 2px solid black;
position: absolute;
}
button:nth-child(1) {
top: 30px;
left: 80px;
}
button:nth-child(2) {
top: 60px;
left: 80px;
}
button:nth-child(3) {
top: 90px;
left: 80px;
}
button:nth-child(4) {
top: 120px;
left: 80px;
}
button:nth-child(5) {
top: 150px;
left: 80px;
}
</style>
</head>
<body>
<button>1</button>
<button>2</button>
<button>3</button>
<button>4</button>
<button>5</button>
<button>6</button>
<button>7</button>
<button>8</button>
<button>9</button>
<button>10</button>
<script>
const teeth = document.querySelectorAll('button');
teeth.forEach(
function(tooth) {
tooth.onclick = function () {
this.parentNode.removeChild(this)
if (Math.random() * document.querySelectorAll('button').length < 1) {
// mouth closes
alert('Lost');
// reload app
}
}
}
);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment