-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
57 lines (50 loc) · 2.05 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
50
51
52
53
54
55
56
57
let slider=document.querySelector(".sliderBall")
let currmode="dark"
let root=document.querySelector(':root');
let mode=document.querySelector("#slideball")
let contact=document.querySelector("#contact")
slider.addEventListener("click",()=>{
if(currmode==="dark"){
slider.classList.add("slide")
root.style.setProperty("--bg-color","#f5e9e9");
root.style.setProperty("--nav-bg-color","rgb(159, 170, 150)");
root.style.setProperty("--txt-col","rgb(21, 20, 20)");
mode.innerHTML="<i class=\"fa-solid fa-sun\"></i>";
contact.style.backgroundColor="rgb(225 213 213)"
currmode="light"
}else{
slider.classList.remove("slide")
root.style.setProperty("--bg-color","#232323");
root.style.setProperty("--nav-bg-color","rgb(88, 98, 80)");
root.style.setProperty("--txt-col","white");
mode.innerHTML="<i class=\"fa-solid fa-moon\"></i>";
contact.style.backgroundColor="rgb(46, 45, 45)"
currmode="dark"
}
})
document.getElementById('bar').addEventListener('click', function() {
var menu = document.getElementById('navMenu');
menu.classList.toggle('active');
});
document.getElementById('cv').addEventListener('click', function() {
var downloadLink = document.createElement('a');
downloadLink.href = 'assets/anshit_resume_latest.pdf';
downloadLink.download = 'Anshit_Sony_CV.pdf';
document.body.appendChild(downloadLink);
downloadLink.click();
document.body.removeChild(downloadLink);
});
const contactForm=document.querySelector('form');
contactForm.addEventListener("submit",()=>{
let name=document.getElementById('name').value;
let email=document.getElementById('email').value;
let message=document.getElementById('message').value;
if(name===""||email===""||message===""){
alert("All fields are required");
return false;
}
else{
alert(`Thank you for your message, ${name}. I will get back to you shortly.`);
return true;
}
})