-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathscript.js
More file actions
333 lines (281 loc) · 9.88 KB
/
script.js
File metadata and controls
333 lines (281 loc) · 9.88 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
// Header scroll effect
window.addEventListener('scroll', () => {
const header = document.getElementById('header');
if (window.scrollY > 100) {
header.classList.add('scrolled');
} else {
header.classList.remove('scrolled');
}
});
// Smooth scrolling for navigation links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
target.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
});
});
// Scroll animations
const observerOptions = {
threshold: 0.1,
rootMargin: '0px 0px -50px 0px'
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('animate');
observer.unobserve(entry.target);
}
});
}, observerOptions);
// Observe all scroll-animate elements
document.querySelectorAll('.scroll-animate').forEach(el => {
observer.observe(el);
});
// Add interactive effects for feature cards
document.querySelectorAll('.feature-card').forEach(card => {
card.addEventListener('mouseenter', function() {
this.style.transform = 'translateY(-10px) scale(1.02)';
});
card.addEventListener('mouseleave', function() {
this.style.transform = 'translateY(0) scale(1)';
});
});
// Add interactive effects for download cards
document.querySelectorAll('.download-card').forEach(card => {
card.addEventListener('mouseenter', function() {
this.style.transform = 'translateY(-5px) scale(1.02)';
});
card.addEventListener('mouseleave', function() {
this.style.transform = 'translateY(0) scale(1)';
});
});
// Loading animation for page
document.addEventListener('DOMContentLoaded', function() {
// Add loading class to body initially
document.body.style.opacity = '0';
// Fade in the page
setTimeout(() => {
document.body.style.transition = 'opacity 0.5s ease';
document.body.style.opacity = '1';
}, 100);
// Initialize any other components
initializeComponents();
});
// Initialize components function
function initializeComponents() {
// Add pulse animation to CTA buttons
const ctaButtons = document.querySelectorAll('.btn-primary');
ctaButtons.forEach(button => {
button.addEventListener('mouseenter', function() {
this.style.animation = 'pulse 0.6s ease';
});
button.addEventListener('animationend', function() {
this.style.animation = '';
});
});
// Add typing effect to hero title (optional)
const heroTitle = document.querySelector('.hero h1');
if (heroTitle) {
// Store original text
const originalText = heroTitle.textContent;
heroTitle.textContent = '';
// Type out the text
let i = 0;
const typeWriter = () => {
if (i < originalText.length) {
heroTitle.textContent += originalText.charAt(i);
i++;
setTimeout(typeWriter, 50);
}
};
// Start typing effect after a delay
setTimeout(typeWriter, 1000);
}
}
// Add CSS animation for pulse effect
const style = document.createElement('style');
style.textContent = `
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.05); }
100% { transform: scale(1); }
}
`;
document.head.appendChild(style);
// Parallax effect for background
window.addEventListener('scroll', () => {
const scrolled = window.pageYOffset;
const background = document.querySelector('.background-effects');
if (background) {
background.style.transform = `translateY(${scrolled * 0.1}px)`;
}
});
// Add mobile menu functionality (if needed in the future)
function initializeMobileMenu() {
const mobileMenuToggle = document.querySelector('.mobile-menu-toggle');
const navLinks = document.querySelector('.nav-links');
if (mobileMenuToggle && navLinks) {
mobileMenuToggle.addEventListener('click', () => {
navLinks.classList.toggle('active');
});
}
}
// Initialize mobile menu
initializeMobileMenu();
// Add keyboard navigation support
document.addEventListener('keydown', (e) => {
// Add escape key to close any open modals or menus
if (e.key === 'Escape') {
const activeElements = document.querySelectorAll('.active');
activeElements.forEach(el => el.classList.remove('active'));
}
// Add enter key support for buttons
if (e.key === 'Enter' && e.target.classList.contains('btn')) {
e.target.click();
}
});
// Performance optimization - debounce scroll events
function debounce(func, wait) {
let timeout;
return function executedFunction(...args) {
const later = () => {
clearTimeout(timeout);
func(...args);
};
clearTimeout(timeout);
timeout = setTimeout(later, wait);
};
}
// Apply debounce to scroll events
const debouncedScrollHandler = debounce(() => {
// Your scroll handling logic here
const header = document.getElementById('header');
if (window.scrollY > 100) {
header.classList.add('scrolled');
} else {
header.classList.remove('scrolled');
}
}, 10);
// Replace the original scroll event listener
window.removeEventListener('scroll', () => {});
window.addEventListener('scroll', debouncedScrollHandler);
// Image loading and effects
document.addEventListener('DOMContentLoaded', function() {
// Lazy loading for images
const images = document.querySelectorAll('img');
const imageObserver = new IntersectionObserver((entries, observer) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
const img = entry.target;
img.style.opacity = '0';
img.style.transition = 'opacity 0.5s ease';
img.onload = () => {
img.style.opacity = '1';
};
// If image is already loaded
if (img.complete) {
img.style.opacity = '1';
}
observer.unobserve(img);
}
});
});
images.forEach(img => imageObserver.observe(img));
});
// Enhanced screenshot hover effects
document.querySelectorAll('.screenshot').forEach(img => {
img.addEventListener('mouseenter', function() {
this.style.filter = 'brightness(1.05) contrast(1.1) saturate(1.1)';
});
img.addEventListener('mouseleave', function() {
this.style.filter = 'brightness(0.95) contrast(1.05)';
});
});
// Logo animation on scroll
window.addEventListener('scroll', () => {
const logo = document.querySelector('.main-logo');
if (logo) {
const scrolled = window.pageYOffset;
const rate = scrolled * -0.5;
logo.style.transform = `translateY(${rate}px)`;
}
});
// Enhanced main logo interactions
document.querySelector('.main-logo').addEventListener('click', function() {
// Add smooth click animation
this.style.transition = 'all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)';
this.style.transform = 'scale(1.25)';
setTimeout(() => {
this.style.transition = 'all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94)';
this.style.transform = 'scale(1.15)';
}, 200);
});
// Navigation logo hover effect
document.querySelector('.nav-logo').addEventListener('mouseenter', function() {
this.style.transition = 'all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94)';
this.style.transform = 'scale(1.1) rotate(5deg)';
});
document.querySelector('.nav-logo').addEventListener('mouseleave', function() {
this.style.transition = 'all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94)';
this.style.transform = 'scale(1) rotate(0deg)';
});
// Image Modal Functions
function openImageModal(imageSrc, imageAlt) {
const modal = document.getElementById('imageModal');
const modalImage = document.getElementById('modalImage');
const modalCaption = document.getElementById('modalCaption');
modal.style.display = 'block';
modalImage.src = imageSrc;
modalImage.alt = imageAlt;
modalCaption.textContent = imageAlt;
// Prevent body scroll when modal is open
document.body.style.overflow = 'hidden';
// Add keyboard support
document.addEventListener('keydown', modalKeyHandler);
}
function closeImageModal() {
const modal = document.getElementById('imageModal');
modal.style.display = 'none';
// Restore body scroll
document.body.style.overflow = 'auto';
// Remove keyboard support
document.removeEventListener('keydown', modalKeyHandler);
}
function modalKeyHandler(e) {
if (e.key === 'Escape') {
closeImageModal();
}
}
// Close modal when clicking outside the image
document.getElementById('imageModal').addEventListener('click', function(e) {
if (e.target === this) {
closeImageModal();
}
});
// Enhanced zoom button effects
document.querySelectorAll('.zoom-btn').forEach(btn => {
btn.addEventListener('mouseenter', function() {
this.style.transform = 'scale(1.1)';
});
btn.addEventListener('mouseleave', function() {
this.style.transform = 'scale(1)';
});
});
// Add loading indicator for modal images
function addImageLoadingEffect() {
const modalImage = document.getElementById('modalImage');
modalImage.addEventListener('load', function() {
this.style.opacity = '1';
});
modalImage.addEventListener('loadstart', function() {
this.style.opacity = '0.5';
});
}
// Initialize image loading effects
document.addEventListener('DOMContentLoaded', addImageLoadingEffect);