main
funix 4 years ago
parent 165772f103
commit 5e8a37ca16
  1. 27
      app.js
  2. 6
      index.html
  3. 20
      style.css

@ -10,6 +10,16 @@ var current = []
var colors = ["var(--red)", "var(--brown)", "var(--green)", "var(--blue)", "var(--yellow)", "var(--orange)", "var(--white)"] var colors = ["var(--red)", "var(--brown)", "var(--green)", "var(--blue)", "var(--yellow)", "var(--orange)", "var(--white)"]
function go() { function go() {
let divs = document.getElementsByClassName("row")
for (let div = 0; div < divs.length; div++) {
if (div != turn) {
document.getElementsByClassName("row")[div].classList.add("disabledButtons");
}
}
document.getElementsByClassName("choiceEl1")[turn].addEventListener("click", function() { document.getElementsByClassName("choiceEl1")[turn].addEventListener("click", function() {
this.style.background = colors[n0] this.style.background = colors[n0]
current[0] = colors[n0] current[0] = colors[n0]
@ -45,6 +55,8 @@ function go() {
n3 = 0 n3 = 0
} }
}) })
} }
go() go()
@ -100,15 +112,20 @@ function check() {
if (areEqual(current, riddle)) { if (areEqual(current, riddle)) {
alert("win") alert("win")
} }
if (turn == 6) { if (turn == 6) {
alert("stop") alert("stop")
} }
turn++ turn++
console.log(turn) current = []
if (turn == 6) {
alert("stop")
}
go() go()
} }
function checkpre() {
if (current.length == 4) {
check()
} else {
console.log("sdv")
}
}

@ -11,7 +11,7 @@
</head> </head>
<body> <body>
<div class="mother">
<div class="row"> <div class="row">
<div class="choice"> <div class="choice">
<button class="choiceEl1"></button> <button class="choiceEl1"></button>
@ -97,11 +97,11 @@
</div> </div>
</div> </div>
<div>
</div> </div>
<button id="check" onclick="check()">CHECK!</button> <button id="check" onclick="checkpre()">CHECK!</button>
<script src="app.js" async defer></script> <script src="app.js" async defer></script>
</body> </body>

@ -15,11 +15,20 @@ html {
padding: 0; padding: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
/* background-color: #000; */
}
.mother {
/* border: solid; */
height: 90%;
display: flex;
flex-direction: column;
justify-content: space-evenly;
} }
button { button {
width: 20px; width: 35px;
height: 20px; height: 35px;
border-radius: 40%; border-radius: 40%;
} }
@ -27,7 +36,7 @@ button {
border: solid; border: solid;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
height: 60px; height: 15%;
width: 90%; width: 90%;
justify-content: space-evenly; justify-content: space-evenly;
margin-left: 5%; margin-left: 5%;
@ -99,3 +108,8 @@ button {
left: 2%; left: 2%;
border-radius: 30px; border-radius: 30px;
} }
.disabledbutton {
pointer-events: none;
opacity: 0.4;
}
Loading…
Cancel
Save