-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
401 lines (350 loc) · 11.9 KB
/
main.js
File metadata and controls
401 lines (350 loc) · 11.9 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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
// Navigation functionality
document.addEventListener('DOMContentLoaded', function() {
console.log('🚀 ALLURA website loading...');
const hamburger = document.getElementById('hamburger');
const navMenu = document.getElementById('nav-menu');
const navLinks = document.querySelectorAll('.nav-link');
// Hamburger menu toggle
if (hamburger && navMenu) {
hamburger.addEventListener('click', function() {
hamburger.classList.toggle('active');
navMenu.classList.toggle('active');
});
}
// Close mobile menu when clicking nav links
navLinks.forEach(link => {
link.addEventListener('click', function() {
if (hamburger && navMenu) {
hamburger.classList.remove('active');
navMenu.classList.remove('active');
}
});
});
// Smooth scrolling for navigation links
navLinks.forEach(link => {
link.addEventListener('click', function(e) {
e.preventDefault();
const targetId = this.getAttribute('href');
const targetSection = document.querySelector(targetId);
if (targetSection) {
const offsetTop = targetSection.offsetTop - 80;
window.scrollTo({
top: offsetTop,
behavior: 'smooth'
});
}
});
});
// Enhanced navbar background on scroll
let lastScrollY = 0;
window.addEventListener('scroll', function() {
const navbar = document.querySelector('.navbar');
const currentScrollY = window.scrollY;
if (navbar) {
if (currentScrollY > 50) {
navbar.style.background = 'rgba(255, 255, 255, 0.98)';
navbar.style.boxShadow = '0 4px 20px rgba(0, 0, 0, 0.1)';
} else {
navbar.style.background = 'rgba(255, 255, 255, 0.95)';
navbar.style.boxShadow = 'none';
}
// Hide navbar on scroll down, show on scroll up
if (currentScrollY > lastScrollY && currentScrollY > 100) {
navbar.style.transform = 'translateY(-100%)';
} else {
navbar.style.transform = 'translateY(0)';
}
lastScrollY = currentScrollY;
}
});
// Enhanced scroll animations
const observerOptions = {
threshold: 0.1,
rootMargin: '0px 0px -50px 0px'
};
const observer = new IntersectionObserver(function(entries) {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('visible');
}
});
}, observerOptions);
// Add animation classes and observe elements
const animateElements = document.querySelectorAll(
'.feature-card, .category-card, .section-header, .hero-stats, .cta-content'
);
animateElements.forEach((el, index) => {
el.classList.add('fade-in');
observer.observe(el);
});
// Category card click handlers with enhanced feedback
const categoryCards = document.querySelectorAll('.category-card');
categoryCards.forEach(card => {
card.addEventListener('click', function() {
const category = this.dataset.category;
// Add click effect
this.style.transform = 'scale(0.95)';
setTimeout(() => {
this.style.transform = '';
}, 150);
// Show notification
showNotification(`${category.charAt(0).toUpperCase() + category.slice(1)} specialized features coming soon!`, 'info');
});
});
// Enhanced button click handlers
const startButtons = document.querySelectorAll('.btn-hero-primary, .btn-cta-primary');
startButtons.forEach(btn => {
btn.addEventListener('click', function() {
showNotification('Sign-up functionality coming soon! 🚀', 'success');
});
});
const demoButtons = document.querySelectorAll('.btn-hero-secondary, .btn-cta-secondary');
demoButtons.forEach(btn => {
btn.addEventListener('click', function() {
showNotification('Interactive demo coming soon! 🎬', 'info');
});
});
// ALLURA text letter-by-letter animation
function animateALLURAText() {
const animatedText = document.querySelector('.animated-text');
if (animatedText && !animatedText.hasAttribute('data-animated')) {
const text = 'ALLURA';
animatedText.innerHTML = '';
animatedText.setAttribute('data-animated', 'true');
[...text].forEach((char, index) => {
const span = document.createElement('span');
span.textContent = char;
span.style.display = 'inline-block';
span.style.opacity = '0';
span.style.transform = 'translateY(50px) rotateX(90deg)';
span.style.transition = 'all 0.8s ease';
span.style.transitionDelay = `${index * 0.1}s`;
animatedText.appendChild(span);
setTimeout(() => {
span.style.opacity = '1';
span.style.transform = 'translateY(0) rotateX(0)';
}, 100 + (index * 100));
});
}
}
// Trigger ALLURA animation after a short delay
setTimeout(animateALLURAText, 500);
// Parallax effect for hero section
window.addEventListener('scroll', function() {
const scrolled = window.pageYOffset;
const rate = scrolled * -0.3;
const heroContent = document.querySelector('.hero-content');
if (heroContent) {
heroContent.style.transform = `translateY(${rate}px)`;
}
});
// Stats counter animation
function animateStatsCounters() {
const statNumbers = document.querySelectorAll('.stat-number');
statNumbers.forEach(stat => {
const text = stat.textContent;
const number = parseInt(text.replace(/[^0-9]/g, ''));
const suffix = text.replace(/[0-9]/g, '');
let current = 0;
const increment = number / 50;
const timer = setInterval(() => {
current += increment;
if (current >= number) {
current = number;
clearInterval(timer);
}
stat.textContent = Math.floor(current) + suffix;
}, 40);
});
}
// Trigger stats animation when they come into view
const statsObserver = new IntersectionObserver(function(entries) {
entries.forEach(entry => {
if (entry.isIntersecting) {
animateStatsCounters();
statsObserver.unobserve(entry.target);
}
});
}, { threshold: 0.5 });
const heroStats = document.querySelector('.hero-stats');
if (heroStats) {
statsObserver.observe(heroStats);
}
// Enhanced feature card interactions
const featureCards = document.querySelectorAll('.feature-card');
featureCards.forEach(card => {
card.addEventListener('mouseenter', function() {
this.style.transform = 'translateY(-15px) scale(1.02)';
this.style.zIndex = '10';
});
card.addEventListener('mouseleave', function() {
this.style.transform = 'translateY(0) scale(1)';
this.style.zIndex = '1';
});
});
// Notification system
function showNotification(message, type = 'info') {
// Create notification container if it doesn't exist
let container = document.querySelector('.notification-container');
if (!container) {
container = document.createElement('div');
container.className = 'notification-container';
container.style.cssText = `
position: fixed;
top: 20px;
right: 20px;
z-index: 10000;
display: flex;
flex-direction: column;
gap: 10px;
`;
document.body.appendChild(container);
}
// Create notification
const notification = document.createElement('div');
notification.className = `notification notification-${type}`;
notification.textContent = message;
notification.style.cssText = `
background: ${type === 'success' ? 'rgba(76, 175, 80, 0.9)' : 'rgba(33, 150, 243, 0.9)'};
color: white;
padding: 15px 20px;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.2);
font-weight: 500;
transform: translateX(100%);
transition: transform 0.3s ease;
cursor: pointer;
max-width: 300px;
`;
container.appendChild(notification);
// Animate in
setTimeout(() => {
notification.style.transform = 'translateX(0)';
}, 100);
// Auto remove
setTimeout(() => {
notification.style.transform = 'translateX(100%)';
setTimeout(() => {
if (notification.parentNode) {
notification.parentNode.removeChild(notification);
}
}, 300);
}, 3000);
// Click to dismiss
notification.addEventListener('click', () => {
notification.style.transform = 'translateX(100%)';
setTimeout(() => {
if (notification.parentNode) {
notification.parentNode.removeChild(notification);
}
}, 300);
});
}
// Loading states for future API calls
window.showLoading = function(element) {
element.style.opacity = '0.6';
element.style.pointerEvents = 'none';
element.style.cursor = 'not-allowed';
};
window.hideLoading = function(element) {
element.style.opacity = '1';
element.style.pointerEvents = 'auto';
element.style.cursor = 'pointer';
};
// Performance optimization: Throttle scroll events
let ticking = false;
function updateScrollEffects() {
ticking = false;
}
window.addEventListener('scroll', function() {
if (!ticking) {
requestAnimationFrame(updateScrollEffects);
ticking = true;
}
});
// Keyboard navigation support
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape') {
// Close mobile menu
if (hamburger && navMenu) {
hamburger.classList.remove('active');
navMenu.classList.remove('active');
}
}
});
// Add focus styles for accessibility
const focusableElements = document.querySelectorAll('button, a, input, select, textarea');
focusableElements.forEach(element => {
element.addEventListener('focus', function() {
this.style.outline = '2px solid #5227FF';
this.style.outlineOffset = '2px';
});
element.addEventListener('blur', function() {
this.style.outline = 'none';
});
});
console.log('✨ ALLURA website fully loaded and interactive!');
});
// Global utilities for future use
window.ALLURA = {
// Analytics tracking (placeholder)
track: function(event, properties) {
console.log('📊 Analytics:', event, properties);
// Future: Send to analytics service
},
// API helpers (placeholder)
api: {
get: async function(endpoint) {
console.log('🌐 API GET:', endpoint);
// Future: API integration
return { success: true, data: {} };
},
post: async function(endpoint, data) {
console.log('🌐 API POST:', endpoint, data);
// Future: API integration
return { success: true, data: {} };
}
},
// User management (placeholder)
user: {
login: function(credentials) {
console.log('🔐 Login attempt:', credentials);
// Future: Authentication
return { success: true, user: {} };
},
signup: function(userData) {
console.log('📝 Signup attempt:', userData);
// Future: Registration
return { success: true, user: {} };
}
},
// Theme management
theme: {
toggle: function() {
document.body.classList.toggle('dark-theme');
localStorage.setItem('theme', document.body.classList.contains('dark-theme') ? 'dark' : 'light');
},
init: function() {
const savedTheme = localStorage.getItem('theme');
if (savedTheme === 'dark') {
document.body.classList.add('dark-theme');
}
}
}
};
// Initialize theme
window.ALLURA.theme.init();
document.addEventListener('DOMContentLoaded', function() {
// Add interactive enhancements for feature cards
document.querySelectorAll('.feature-card').forEach((card, index) => {
card.addEventListener('mouseenter', () => {
card.style.transform += ' scale(1.02)';
card.style.transition = 'transform 0.3s ease';
});
card.addEventListener('mouseleave', () => {
card.style.transition = 'transform 0.3s ease';
});
});
});