-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
155 lines (127 loc) · 4.49 KB
/
Copy pathscript.js
File metadata and controls
155 lines (127 loc) · 4.49 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
let menuIcon = document.querySelector(".menu-icon");
let navlist = document.querySelector(".navlist")
menuIcon.addEventListener("click", () => {
menuIcon.classList.toggle("active");
navlist.classList.toggle("active");
document.body.classList.toggle("open");
});
navlist.addEventListener("click", () => {
navlist.classList.remove("active");
menuIcon.classList.remove("active");
document.body.classList.remove("open");
})
let text = document.querySelector(".text p");
text.innerHTML = text.innerHTML.split("").map((char, i) =>
`<b style="transform:rotate(${i * 6.3}deg")>${char}</b>`
).join("");
const buttons = document.querySelectorAll('.about-btn button');
const contents = document.querySelectorAll('.content');
buttons.forEach((button, index) => {
button.addEventListener('click', () => {
contents.forEach(content => content.style.display = 'none');
contents[index].style.display = 'block';
buttons.forEach(btn => btn.classList.remove('active'));
button.classList.add('active');
});
});
var mixer = mixitup('.portfolio-gallery', {
selectors: {
target: '.portfolio-box'
},
animation: {
duration: 500
}
});
var swiper = new Swiper(".mySwiper", {
slidesPerView: 1,
spaceBetween: 30,
pagination: {
el: ".swiper-pagination",
clickable: true,
},
autoplay: {
delay: 3000,
disableOnInteraction: false,
},
breakpoints: {
576: {
slidesPerView: 2,
spaceBetween: 10,
},
1200: {
slidesPerView: 3,
spaceBetween: 20,
},
}
});
const first_skill = document.querySelector(".skill:first-child");
const sk_counters = document.querySelectorAll(".counter span");
const progress_bars = document.querySelectorAll(".skills svg circle");
window.addEventListener("scroll", () => {
if (!skillsPlayed)
skillsCounter();
})
function hasReached(el) {
let topPosition = el.getBoundingClientRect().top;
if (window.innerHeight >= topPosition + el.offsetHeight) return true;
return false;
}
function updateCount(num, maxNum) {
let currentNum = +num.innerText;
if (currentNum < maxNum) {
num.innerText = currentNum + 1;
setTimeout(() => {
updateCount(num, maxNum)
}, 12)
}
}
let skillsPlayed = false;
function skillsCounter() {
if (!hasReached(first_skill)) return;
skillsPlayed = true;
sk_counters.forEach((counter, i) => {
let target = +counter.dataset.target;
let strokeValue = 465 - 465 * (target / 100);
progress_bars[i].style.setProperty("--target", strokeValue);
setTimeout(() => {
updateCount(counter, target);
}, 400)
});
progress_bars.forEach(p => p.style.animation = "progress 2s ease-in-out forwards");
}
let calcScrollValue = () => {
let scrollProgress = document.getElementById("progress");
let pos = document.documentElement.scrollTop;
let calcHeight = document.documentElement.scrollHeight - document.documentElement.clientHeight;
let scrollValue = Math.round((pos * 100) / calcHeight);
if (pos > 100) {
scrollProgress.style.display = "grid";
} else {
scrollProgress.style.display = "none";
}
scrollProgress.addEventListener("click", () => {
document.documentElement.scrollTop = 0;
});
scrollProgress.style.background = `conic-gradient(#fff ${scrollValue}%,#e6006d ${scrollValue}%)`;
};
window.onscroll = calcScrollValue;
window.onload = calcScrollValue;
let menuLi = document.querySelectorAll("header ul li a");
let section = document.querySelectorAll('section');
function activeMenu() {
let len = section.length;
while (--len && window.scrollY + 97 < section[len].offsetTop) { }
menuLi.forEach(sec => sec.classList.remove("active"));
menuLi[len].classList.add("active");
}
activeMenu();
window.addEventListener("scroll", activeMenu);
ScrollReveal({
distance: "90px",
duration: 2000,
delay: 200,
});
ScrollReveal().reveal('.hero-info,.main-text,.proposal,.heading', { origin: "top" });
ScrollReveal().reveal('.about-img,.fillter-buttons,.contact-info', { origin: "left" });
ScrollReveal().reveal('.about-content,.skills', { origin: "right" });
ScrollReveal().reveal('.allServices,.portfolio-gallery,.blog-box,footer,.img-hero', { origin: "bottom" });