-
Notifications
You must be signed in to change notification settings - Fork 1
/
script.js
72 lines (69 loc) · 2.35 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
let i = 0;
let txt = 'I\'m a full stack web developer.';
let speed = 50;
function typeText() {
if (i < txt.length) {
document.getElementById("text-nav").innerHTML += txt.charAt(i);
i++;
setTimeout(typeText, speed);
}
}
function closeError() {
let error = document.getElementById("errs");
error.style = "transform: scale(0)";
}
document.querySelector("#firstname").addEventListener("click", function() {
errs.style = "transform: scale(0);";
});
document.querySelector("#lastname").addEventListener("click", function() {
errs.style = "transform: scale(0);";
});
document.querySelector("#email").addEventListener("click", function() {
errs.style = "transform: scale(0);";
});
document.querySelector("#subject").addEventListener("click", function() {
errs.style = "transform: scale(0);";
});
document.querySelector("#message").addEventListener("click", function() {
errs.style = "transform: scale(0);";
});
typeText();
let footer = document.getElementById('footer-content');
let presentYear = new Date().getFullYear();
footer.innerHTML = "© Narcis " + presentYear;
let modal = document.getElementById("modal");
let modalContent = document.getElementsByClassName("modal-content")[0];
let btn = document.getElementById("menulogo");
let span = document.getElementById("close");
let buttonPhone = document.getElementsByClassName("btns");
btn.onclick = function() {
modalContent.style = "transform: scaleX(1)";
modal.style = "display: inline";
}
for (let i = 0; i < buttonPhone.length; i++) {
buttonPhone[i].onclick = function() {
modalContent.style = "transform: scaleX(0)";
modal.style = "display: none";
}
}
span.onclick = function() {
modalContent.style = "transform: scaleX(0)";
modal.style = "display: none";
}
document.addEventListener("DOMContentLoaded", function(event) {
var themeSwitcher = document.getElementById("theme-switcher");
var themeSwitchers = document.getElementById("theme-switchers");
changeTheme(themeSwitcher);
changeTheme(themeSwitchers);
});
function changeTheme (element) {
element.onclick = function() {
element.style = "transform: scale(0.1)";
var currentTheme = document.documentElement.getAttribute("data-theme");
var switchToTheme = currentTheme === "dark" ? "light" : "dark";
document.documentElement.setAttribute("data-theme", switchToTheme);
setTimeout(function() {
element.style = "transform: scale(1)";
}, 300);
}
}