forked from devvsakib/hackerboi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
57 lines (48 loc) · 1.8 KB
/
app.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
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
const unlockLock = document.querySelector('.lockUnlock'),
pass = document.querySelector('#pass'),
lockAgain = document.querySelector('.lock'),
submit = document.querySelector('#submit'),
freedom = document.querySelector(".freedom")
document.querySelector("body").style.overflow = "hidden"
freedom.classList.add('hide');
submit.onclick = () => {
event.preventDefault()
getPass = pass.value;
const times = new Date();
const hour = times.getHours();
const minute = times.getMinutes();
let passToMatch = `${hour}${minute}`
if (Number(getPass) == passToMatch) {
unlockLock.classList.add('hide');
freedom.classList.remove('hide');
unlockLock.style.opacity = "0";
unlockLock.style.transition = "1200ms cubic-bezier(0.25, 0.46, 0.45, 0.94)";
document.body.style.overflow = "auto";
pass.value = ""
}
else if (getPass == '') {
alert("Password Required");
}
else {
alert("Think Twice!!");
}
}
lockAgain.onclick = () => {
window.scrollTo(0, 0);
unlockLock.classList.remove('hide');
document.querySelector("body").style.overflow = "hidden"
unlockLock.style.opacity = "100";
freedom.classList.add('hide')
}
window.onscroll = () => {
// if scrollY greater than 0 sticky-nav class will be added
var menuContainer = document.querySelector(".menuContainer");
menuContainer.classList.toggle("sticky-nav",window.scrollY>0);
if (window.scrollY <= 20) {
document.querySelector(".downArrow").style.opacity = '1';
document.querySelector(".downArrow").style.transition = '300ms ease-in-out';
} else {
document.querySelector(".downArrow").style.opacity = '0';
document.querySelector(".downArrow").style.transition = '300ms ease-in-out';
}
}