-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
69 lines (54 loc) · 2.03 KB
/
Copy pathscript.js
File metadata and controls
69 lines (54 loc) · 2.03 KB
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
// Navigation
const menuIcon = document.querySelector(".menu-icon");
const navbar = document.querySelector(".navigation-list");
const scrollFn = () => {
menuIcon.classList.add("show-menu-icon");
navbar.classList.add("hide-navbar");
if (window.scrollY === 0) {
menuIcon.classList.remove("show-menu-icon");
navbar.classList.remove("hide-navbar");
}
};
document.addEventListener("scroll", scrollFn);
menuIcon.addEventListener("click", () => {
menuIcon.classList.remove("show-menu-icon");
navbar.classList.remove("hide-navbar");
});
// End of Navigation
const aboutMeText = document.querySelector(".about-me");
const aboutMeTextContent =
"I am a Designer & I create beautiful websites with great user experience. Want to connect? Just contact me. :)";
Array.from(aboutMeTextContent).forEach((char) => {
const span = document.createElement("span");
span.textContent = char;
aboutMeText.appendChild(span);
span.addEventListener("mouseenter", (e) => {
e.target.style.animation = "aboutMeTextAnim 10s infinite";
});
})
// Projects
const container = document.querySelector(".container");
const projects = document.querySelectorAll(".project-img");
projects.forEach((project, i) => {
project.addEventListener("mouseenter", () => {
project.firstElementChild.style.top = `-${
project.firstElementChild.offsetHeight - project.offsetHeight + 20
}px`;
});
project.addEventListener("mouseleave", () => {
project.firstElementChild.style.top = "2rem";
});
});
// section - skills
// My-skill sets
document.querySelectorAll(".skill-heading").forEach((service) => {
service.addEventListener("click", (e) => {
e.preventDefault();
const serviceText = service.nextElementSibling;
serviceText.classList.toggle("change");
const rightPosition = serviceText.classList.contains("change")
? `calc(100% - ${getComputedStyle(service.firstElementChild).width})`
: 0;
service.firstElementChild.style.right = rightPosition;
});
});