-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
91 lines (79 loc) · 2.11 KB
/
Copy pathmain.js
File metadata and controls
91 lines (79 loc) · 2.11 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
const navMenu = document.getElementById("nav-menu"),
navToggle = document.getElementById("nav-toggle"),
navItem = document.querySelectorAll(".nav__item"),
header = document.getElementById("header");
// open and close menu
navToggle.addEventListener("click", () => {
navMenu.classList.toggle("nav__menu--open");
changeIcon();
});
// close the menu when the user clicks the nav links
navItem.forEach((item) => {
item.addEventListener("click", () => {
if (navMenu.classList.contains("nav__menu--open")) {
navMenu.classList.remove("nav__menu--open");
}
changeIcon();
});
});
// Change nav toggle icon
function changeIcon() {
if (navMenu.classList.contains("nav__menu--open")) {
navToggle.classList.replace("ri-menu-3-line", "ri-close-line");
} else {
navToggle.classList.replace("ri-close-line", "ri-menu-3-line");
}
}
// Testimonial Slide
const testimonialSlide = new Swiper(".testimonial__wrapper", {
loop: true,
spaceBetween: 30,
centeredSlides: true,
effect: "coverflow",
grabCursor: true,
slidesPerView: 1,
coverflowEffect: {
rotate: 50,
stretch: 0,
depth: 100,
modifier: 1,
slideShadows: true,
},
pagination: {
el: ".swiper-pagination",
clickable: true,
},
breakpoints: {
520: {
slidesPerView: "auto",
},
},
});
// header scroll animation
window.addEventListener("scroll", () => {
if (window.scrollY > 40) {
header.classList.add("header--scroll");
} else {
header.classList.remove("header--scroll");
}
});
// ScrollReveal animations
const sr = ScrollReveal({
duration: 2000,
distance: "100px",
delay: 400,
reset: false,
});
sr.reveal(".hero__content, .about__content");
sr.reveal(".hero__img", { origin: "top" });
sr.reveal(
".hero__info-wrapper, .skills__title, .skills__content, .qualification__name, .qualification__item, .service__card, .project__content, .testimonial__wrapper, .footer__content",
{
delay: 500,
interval: 100,
}
);
sr.reveal(".qualification__footer-text, .contact__content", {
origin: "left",
});
sr.reveal(".qualification__footer .btn, .contact__btn", { origin: "right" });