Spaces:
Sleeping
Sleeping
File size: 16,624 Bytes
7851df6 | 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 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 | // Landing Page JavaScript
// DOM Content Loaded
document.addEventListener('DOMContentLoaded', function() {
initializeAnimations();
initializeNavigation();
initializeROICalculator();
initializeChatDemo();
initializeContactForm();
initializeScrollAnimations();
});
// Navigation functionality
function initializeNavigation() {
const navbar = document.querySelector('.navbar');
const hamburger = document.getElementById('hamburger');
const navMenu = document.getElementById('navMenu');
// Scroll effect for navbar
window.addEventListener('scroll', function() {
if (window.scrollY > 50) {
navbar.classList.add('scrolled');
} else {
navbar.classList.remove('scrolled');
}
});
// Mobile menu toggle
hamburger.addEventListener('click', function() {
navMenu.classList.toggle('active');
hamburger.classList.toggle('active');
});
// Smooth scrolling for nav links
document.querySelectorAll('.nav-link').forEach(link => {
link.addEventListener('click', function(e) {
e.preventDefault();
const targetId = this.getAttribute('href');
const targetSection = document.querySelector(targetId);
if (targetSection) {
targetSection.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
// Close mobile menu if open
navMenu.classList.remove('active');
hamburger.classList.remove('active');
});
});
}
// Scroll animations
function initializeScrollAnimations() {
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('aos-animate');
}
});
}, observerOptions);
// Observe all elements with data-aos attribute
document.querySelectorAll('[data-aos]').forEach(el => {
observer.observe(el);
});
}
// ROI Calculator
function initializeROICalculator() {
const studentCountInput = document.getElementById('studentCount');
const staffCountInput = document.getElementById('staffCount');
const staffSalaryInput = document.getElementById('staffSalary');
const annualSavingsElement = document.getElementById('annualSavings');
const paybackPeriodElement = document.getElementById('paybackPeriod');
const threeYearROIElement = document.getElementById('threeYearROI');
function calculateROI() {
const studentCount = parseInt(studentCountInput.value) || 0;
const staffCount = parseInt(staffCountInput.value) || 0;
const staffSalary = parseInt(staffSalaryInput.value) || 0;
// Calculate based on 70% efficiency improvement
const currentAnnualCost = staffCount * staffSalary;
const staffReduction = Math.floor(staffCount * 0.7);
const annualSavings = staffReduction * staffSalary;
// Estimate edi.chat cost based on student count
let monthlyCost = 2500; // Base cost
if (studentCount > 2500) monthlyCost = 5500;
if (studentCount > 15000) monthlyCost = 12000;
const annualCost = monthlyCost * 12;
const netSavings = annualSavings - annualCost;
// Payback period in months
const paybackMonths = annualCost / (annualSavings / 12);
// 3-year ROI
const threeYearSavings = netSavings * 3;
const threeYearROI = (threeYearSavings / annualCost) * 100;
// Update display
annualSavingsElement.textContent = `$${netSavings.toLocaleString()}`;
paybackPeriodElement.textContent = `${paybackMonths.toFixed(1)} months`;
threeYearROIElement.textContent = `${Math.max(0, threeYearROI).toFixed(0)}%`;
}
// Add event listeners
[studentCountInput, staffCountInput, staffSalaryInput].forEach(input => {
input.addEventListener('input', calculateROI);
});
// Initial calculation
calculateROI();
}
// Chat Demo Animation
function initializeChatDemo() {
const messagesContainer = document.getElementById('chatMessages');
if (!messagesContainer) return;
// Simulate typing animation
function simulateTyping() {
const messages = messagesContainer.querySelectorAll('.message');
// Hide all messages initially
messages.forEach((message, index) => {
message.style.opacity = '0';
message.style.transform = 'translateY(20px)';
});
// Show messages with delay
messages.forEach((message, index) => {
setTimeout(() => {
message.style.transition = 'opacity 0.5s ease, transform 0.5s ease';
message.style.opacity = '1';
message.style.transform = 'translateY(0)';
}, index * 1500);
});
}
// Start simulation when chat demo is visible
const chatDemo = document.querySelector('.chat-demo');
const observerOptions = {
threshold: 0.5,
rootMargin: '0px'
};
const observer = new IntersectionObserver(function(entries) {
entries.forEach(entry => {
if (entry.isIntersecting) {
setTimeout(simulateTyping, 1000);
observer.unobserve(entry.target);
}
});
}, observerOptions);
if (chatDemo) {
observer.observe(chatDemo);
}
}
// Contact Form
function initializeContactForm() {
const contactForm = document.getElementById('contactForm');
if (!contactForm) return;
contactForm.addEventListener('submit', async function(e) {
e.preventDefault();
const submitButton = contactForm.querySelector('.submit-button');
const buttonText = submitButton.querySelector('.button-text');
const buttonLoading = submitButton.querySelector('.button-loading');
// Show loading state
buttonText.style.display = 'none';
buttonLoading.style.display = 'flex';
submitButton.disabled = true;
// Collect form data
const formData = new FormData(contactForm);
const data = Object.fromEntries(formData.entries());
try {
// Simulate form submission
await new Promise(resolve => setTimeout(resolve, 2000));
// Show success message
showNotification('Thank you! We\'ll contact you within 24 hours to schedule your demo.', 'success');
contactForm.reset();
} catch (error) {
showNotification('There was an error submitting your request. Please try again.', 'error');
}
// Reset button state
buttonText.style.display = 'inline';
buttonLoading.style.display = 'none';
submitButton.disabled = false;
});
}
// Demo Modal
function openDemo() {
const modal = document.getElementById('demoModal');
modal.classList.add('show');
document.body.style.overflow = 'hidden';
}
function closeDemo() {
const modal = document.getElementById('demoModal');
modal.classList.remove('show');
document.body.style.overflow = 'auto';
}
// Close modal when clicking outside
document.getElementById('demoModal').addEventListener('click', function(e) {
if (e.target === this) {
closeDemo();
}
});
// Scroll to contact section
function scrollToContact() {
document.getElementById('contact').scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
// Notification system
function showNotification(message, type = 'info') {
// Remove existing notifications
const existingNotifications = document.querySelectorAll('.notification');
existingNotifications.forEach(notification => notification.remove());
// Create notification element
const notification = document.createElement('div');
notification.className = `notification notification-${type}`;
notification.innerHTML = `
<div class="notification-content">
<span class="notification-message">${message}</span>
<button class="notification-close" onclick="this.parentElement.parentElement.remove()">×</button>
</div>
`;
// Add styles
notification.style.cssText = `
position: fixed;
top: 20px;
right: 20px;
background: ${type === 'success' ? '#10B981' : type === 'error' ? '#EF4444' : '#4F46E5'};
color: white;
padding: 16px 20px;
border-radius: 12px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
z-index: 3000;
max-width: 400px;
animation: slideInFromRight 0.3s ease;
`;
// Add notification to body
document.body.appendChild(notification);
// Auto remove after 5 seconds
setTimeout(() => {
if (notification.parentElement) {
notification.style.animation = 'slideOutToRight 0.3s ease';
setTimeout(() => notification.remove(), 300);
}
}, 5000);
}
// Initialize animations
function initializeAnimations() {
// Add CSS animations
const style = document.createElement('style');
style.textContent = `
@keyframes slideInFromRight {
from {
transform: translateX(100%);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
@keyframes slideOutToRight {
from {
transform: translateX(0);
opacity: 1;
}
to {
transform: translateX(100%);
opacity: 0;
}
}
.notification-content {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
}
.notification-close {
background: none;
border: none;
color: white;
font-size: 1.5rem;
cursor: pointer;
padding: 0;
line-height: 1;
}
.notification-close:hover {
opacity: 0.8;
}
.hamburger.active span:nth-child(1) {
transform: rotate(45deg) translate(5px, 5px);
}
.hamburger.active span:nth-child(2) {
opacity: 0;
}
.hamburger.active span:nth-child(3) {
transform: rotate(-45deg) translate(7px, -6px);
}
@media (max-width: 768px) {
.nav-menu.active {
display: flex !important;
position: absolute;
top: 100%;
left: 0;
right: 0;
background: white;
flex-direction: column;
padding: 20px;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
border-radius: 0 0 15px 15px;
}
.nav-menu.active .nav-link {
padding: 10px 0;
border-bottom: 1px solid #E5E7EB;
}
.nav-menu.active .nav-link:last-child {
border-bottom: none;
}
.nav-menu.active .cta-button {
margin-top: 10px;
align-self: center;
}
}
`;
document.head.appendChild(style);
}
// Pricing card interactions
document.addEventListener('DOMContentLoaded', function() {
const pricingCards = document.querySelectorAll('.pricing-card');
pricingCards.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)';
});
});
});
// Feature card hover effects
document.addEventListener('DOMContentLoaded', function() {
const featureCards = document.querySelectorAll('.feature-card');
featureCards.forEach(card => {
card.addEventListener('mouseenter', function() {
const icon = this.querySelector('.feature-icon');
if (icon) {
icon.style.transform = 'scale(1.1) rotate(5deg)';
}
});
card.addEventListener('mouseleave', function() {
const icon = this.querySelector('.feature-icon');
if (icon) {
icon.style.transform = 'scale(1) rotate(0deg)';
}
});
});
});
// Testimonial card animations
document.addEventListener('DOMContentLoaded', function() {
const testimonialCards = document.querySelectorAll('.testimonial-card');
testimonialCards.forEach((card, index) => {
card.style.animationDelay = `${index * 0.2}s`;
});
});
// Smooth reveal animation for sections
function revealOnScroll() {
const reveals = document.querySelectorAll('[data-aos]');
reveals.forEach(element => {
const windowHeight = window.innerHeight;
const elementTop = element.getBoundingClientRect().top;
const elementVisible = 150;
if (elementTop < windowHeight - elementVisible) {
element.classList.add('aos-animate');
}
});
}
window.addEventListener('scroll', revealOnScroll);
// Initialize parallax effect for hero background
function initializeParallax() {
const floatingElements = document.querySelectorAll('.floating-element');
window.addEventListener('scroll', () => {
const scrolled = window.pageYOffset;
const rate = scrolled * -0.5;
floatingElements.forEach((element, index) => {
const speed = 0.5 + (index * 0.1);
element.style.transform = `translateY(${rate * speed}px)`;
});
});
}
// Initialize on load
document.addEventListener('DOMContentLoaded', function() {
initializeParallax();
// Add loading animation for the page
document.body.style.opacity = '0';
document.body.style.transition = 'opacity 0.5s ease';
setTimeout(() => {
document.body.style.opacity = '1';
}, 100);
});
// Keyboard navigation
document.addEventListener('keydown', function(e) {
// Close modal with Escape key
if (e.key === 'Escape') {
const modal = document.getElementById('demoModal');
if (modal.classList.contains('show')) {
closeDemo();
}
}
});
// Performance optimization - Lazy load images
function lazyLoadImages() {
const images = document.querySelectorAll('img[data-src]');
const imageObserver = new IntersectionObserver((entries, observer) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
const img = entry.target;
img.src = img.dataset.src;
img.classList.remove('lazy');
observer.unobserve(img);
}
});
});
images.forEach(img => imageObserver.observe(img));
}
// Initialize lazy loading
document.addEventListener('DOMContentLoaded', lazyLoadImages);
// Add custom cursor effect for interactive elements
function initializeCustomCursor() {
const cursor = document.createElement('div');
cursor.className = 'custom-cursor';
cursor.style.cssText = `
position: fixed;
width: 20px;
height: 20px;
background: rgba(79, 70, 229, 0.3);
border-radius: 50%;
pointer-events: none;
z-index: 9999;
transition: transform 0.1s ease;
display: none;
`;
document.body.appendChild(cursor);
document.addEventListener('mousemove', (e) => {
cursor.style.left = e.clientX - 10 + 'px';
cursor.style.top = e.clientY - 10 + 'px';
cursor.style.display = 'block';
});
// Scale up on hover over interactive elements
const interactiveElements = document.querySelectorAll('button, a, .feature-card, .pricing-card, .testimonial-card');
interactiveElements.forEach(element => {
element.addEventListener('mouseenter', () => {
cursor.style.transform = 'scale(2)';
cursor.style.background = 'rgba(79, 70, 229, 0.5)';
});
element.addEventListener('mouseleave', () => {
cursor.style.transform = 'scale(1)';
cursor.style.background = 'rgba(79, 70, 229, 0.3)';
});
});
}
// Initialize custom cursor on desktop only
if (window.innerWidth > 768) {
document.addEventListener('DOMContentLoaded', initializeCustomCursor);
} |