-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinteractions.js
30 lines (26 loc) · 1.15 KB
/
interactions.js
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
function onCodeInput(number) {
var currentText = document.getElementById("guess" + number).value
if (currentText.length >= 2) {
document.getElementById("guess" + number).value = currentText.charAt(1)
}
//Check If Correct Code
if (correctCode[0] == guess1.value && correctCode[1] == guess2.value && correctCode[2] == guess3.value) {
guess1.disabled = true
guess2.disabled = true
guess3.disabled = true
continueButton.disabled = false
headerLabel.innerHTML = "GOOD JOB!"
//Animations
document.getElementById("lockAnimation").style.backgroundPosition = "0px -32px"
animateWithReflow("continueButton", "bounce-in")
}
}
function revealAnswer() {
document.getElementById("answerLabel").innerHTML = correctCode[0] + "" + correctCode[1] + "" + correctCode[2]
}
function animateWithReflow(element, animation) {
document.getElementById(element).classList.remove(animation)
void document.getElementById(element).offsetWidth
document.getElementById(element).classList.add(animation)
document.getElementById(element).style.opacity = "1"
}