-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
49 lines (28 loc) · 1.1 KB
/
script.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
// Windows 11 Calculator with Dark Mode, Slide-in Menu and Click to Copy - HTML, CSS & JavaScript
// Follow me on;
// Twitter: https://twitter.com/ericaimhigh
// Instagram: https://instagram.com/@ericaimhigh_
// Threads: https://threads.net/@ericaimhigh_
//Dark Mode Switch
let themeBtn = document.querySelector(".theme");
const body = document.querySelector("body");
themeBtn.addEventListener("click", () => {
body.classList.toggle("dark");
})
let menuToggle = document.querySelector('.menuBtn');
let menuToggle2 = document.querySelector('.menuBtn2');
let menu = document.querySelector(".menu");
menuToggle.addEventListener("click", () => {
menu.classList.toggle("active");
})
menuToggle2.addEventListener("click", () => {
menu.classList.toggle("active");
})
let copyBtn = document.querySelector(".fa-copy");
let copyText = document.querySelector(".display");
copyText.select();
copyText.setSelectionRange(0, 99999);
copyBtn.addEventListener("click", () => {
navigator.clipboard.writeText(copyText.value);
alert("Answer copied")
});