forked from coderiderr/Lockscreen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
25 lines (25 loc) · 818 Bytes
/
main.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
let elem = document.querySelector(".lockscreen");
function screenLock() {
elem.classList.add("lock")
elem.classList.remove("unlock")
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else if (elem.webkitRequestFullscreen) {
elem.webkitRequestFullscreen();
} else if (elem.msRequestFullscreen) {
elem.msRequestFullscreen();
}
}
function screenUnlock() {
elem.classList.add("unlock")
elem.classList.remove("lock")
setTimeout(() => {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
}, 1000);
}