-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
152 lines (119 loc) · 4.24 KB
/
script.js
File metadata and controls
152 lines (119 loc) · 4.24 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
document.addEventListener("DOMContentLoaded", function () {
// 3D Carousel setup
const carousel = document.getElementById('carousel');
const items = document.querySelectorAll('.carousel-item');
const itemCount = items.length;
const rotateAmount = 360 / itemCount;
let angle = 0;
items.forEach((item, i) => {
const rotation = i * rotateAmount;
item.style.transform = `rotateY(${rotation}deg) translateZ(500px)`;
});
window.rotateCarousel = function (direction) {
angle += direction * rotateAmount;
carousel.style.transform = `rotateY(${angle}deg)`;
};
// Scroll animation
const elements = document.querySelectorAll('.animate-on-scroll');
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('visible');
observer.unobserve(entry.target);
}
});
}, { threshold: 0.1 });
elements.forEach(el => observer.observe(el));
// ✅ Title click logic
const titles = document.querySelectorAll('.project-titles h1');
// Title 1 elements
const video = document.getElementById('projectVideo');
const description = document.getElementById('projectDescription');
const techBox = document.getElementById('techBox');
// Title 2 (Website) elements
const webVideo = document.getElementById('webVideo');
const webTech = document.getElementById('webTech');
const webDesc = document.getElementById('webDesc');
// Title 3 (Ticket) elements
const ticketVideo = document.getElementById('ticketVideo');
const ticketTech = document.getElementById('ticketTech');
const ticketDesc = document.getElementById('ticketDesc');
// Title 4 (Lovato) elements
const lovatoVideo = document.getElementById('lovatoVideo');
const lovatoTech = document.getElementById('lovatoTech');
const lovatoDesc = document.getElementById('lovatoDesc');
// Title 5 (API) elements
const apiVideo = document.getElementById('apiVideo');
const apiTech = document.getElementById('apiTech');
const apiDesc = document.getElementById('apiDesc');
function hideAll() {
video && (video.style.display = 'none');
description && (description.style.display = 'none');
techBox && (techBox.style.display = 'none');
webVideo && (webVideo.style.display = 'none');
webTech && (webTech.style.display = 'none');
webDesc && (webDesc.style.display = 'none');
ticketVideo && (ticketVideo.style.display = 'none');
ticketTech && (ticketTech.style.display = 'none');
ticketDesc && (ticketDesc.style.display = 'none');
lovatoVideo && (lovatoVideo.style.display = 'none');
lovatoTech && (lovatoTech.style.display = 'none');
lovatoDesc && (lovatoDesc.style.display = 'none');
apiVideo && (apiVideo.style.display = 'none');
apiTech && (apiTech.style.display = 'none');
apiDesc && (apiDesc.style.display = 'none');
}
function showTitle1() {
video && (video.style.display = 'block');
description && (description.style.display = 'block');
techBox && (techBox.style.display = 'block');
}
function showWeb() {
webVideo.style.display = 'block';
webTech.style.display = 'block';
webDesc.style.display = 'block';
}
function showticket() {
ticketVideo.style.display = 'block';
ticketTech.style.display = 'block';
ticketDesc.style.display = 'block';
}
function showLovato() {
lovatoVideo.style.display = 'block';
lovatoTech.style.display = 'block';
lovatoDesc.style.display = 'block';
}
function showApi() {
apiVideo.style.display = 'block';
apiTech.style.display = 'block';
apiDesc.style.display = 'block';
}
if (titles.length > 0) {
// Show Title 1 content on load
titles[0].classList.add('active');
hideAll();
showTitle1();
}
titles.forEach((title, index) => {
title.addEventListener('click', () => {
titles.forEach(t => t.classList.remove('active'));
title.classList.add('active');
hideAll();
if (index === 0) {
showTitle1();
}
else if (index === 1) {
showWeb();
}
else if (index === 2) {
showticket();
}
else if (index === 3) {
showLovato();
}
else if (index === 4) {
showApi();
}
});
});
});