|
| 1 | +// Form submission handler |
| 2 | +function handleSubmit(event) { |
| 3 | + const submitButton = document.querySelector('.submit-button'); |
| 4 | + const originalText = submitButton.textContent; |
| 5 | + submitButton.disabled = true; |
| 6 | + submitButton.textContent = 'Sending...'; |
| 7 | + |
| 8 | + setTimeout(() => { |
| 9 | + alert('Thank you for your message! We will get back to you soon.'); |
| 10 | + document.querySelector('.contact-form').reset(); |
| 11 | + submitButton.disabled = false; |
| 12 | + submitButton.textContent = originalText; |
| 13 | + }, 1000); |
| 14 | + |
| 15 | + return true; |
| 16 | +} |
| 17 | + |
| 18 | +function toggleDetails(id) { |
| 19 | + const detail = document.getElementById(id); |
| 20 | + const allDetails = document.querySelectorAll('.app-details'); |
| 21 | + |
| 22 | + allDetails.forEach(d => { |
| 23 | + if (d.id !== id) { |
| 24 | + d.classList.remove('active'); |
| 25 | + } |
| 26 | + }); |
| 27 | + |
| 28 | + detail.classList.toggle('active'); |
| 29 | +} |
| 30 | + |
| 31 | + |
| 32 | +// Smooth scrolling |
| 33 | +document.querySelectorAll('a[href^="#"]').forEach(anchor => { |
| 34 | + anchor.addEventListener('click', function (e) { |
| 35 | + e.preventDefault(); |
| 36 | + const target = document.querySelector(this.getAttribute('href')); |
| 37 | + if (target) { |
| 38 | + target.scrollIntoView({ |
| 39 | + behavior: 'smooth', |
| 40 | + block: 'start' |
| 41 | + }); |
| 42 | + } |
| 43 | + }); |
| 44 | +}); |
| 45 | + |
| 46 | +// Carousel |
| 47 | +window.addEventListener("load", () => { |
| 48 | + const firstVideo = document.getElementById('carla-video'); |
| 49 | + console.log(firstVideo) |
| 50 | + |
| 51 | + if (firstVideo) { |
| 52 | + setTimeout(() => { |
| 53 | + console.log('now'); |
| 54 | + //firstVideo.play(); |
| 55 | + firstVideo.play().catch(() => { |
| 56 | + console.log('fail') |
| 57 | + }); |
| 58 | + }, 1000); |
| 59 | + |
| 60 | + } |
| 61 | +}); |
| 62 | + |
| 63 | +// let currentSlide = 0; |
| 64 | +// const track = document.getElementById('carouselTrack'); |
| 65 | +// const indicators = document.querySelectorAll('.indicator'); |
| 66 | +// const totalSlides = document.querySelectorAll('.carousel-item').length; |
| 67 | + |
| 68 | +// function updateCarousel() { |
| 69 | +// track.style.transform = `translateX(-${currentSlide * 100}%)`; |
| 70 | + |
| 71 | +// indicators.forEach((indicator, index) => { |
| 72 | +// indicator.classList.toggle('active', index === currentSlide); |
| 73 | +// }); |
| 74 | +// } |
| 75 | + |
| 76 | +// Carousel functionality |
| 77 | +let currentSlide = 0; |
| 78 | +const track = document.getElementById('carouselTrack'); |
| 79 | +const indicators = document.querySelectorAll('.indicator'); |
| 80 | +const totalSlides = document.querySelectorAll('.carousel-item').length; |
| 81 | + |
| 82 | +// Initialize carousel and videos |
| 83 | +document.addEventListener('DOMContentLoaded', function () { |
| 84 | + const allCarouselVideos = document.querySelectorAll('.carousel-item video'); |
| 85 | + |
| 86 | + console.log('Found', allCarouselVideos.length, 'videos'); |
| 87 | + |
| 88 | + // Load all videos |
| 89 | + allCarouselVideos.forEach((video, index) => { |
| 90 | + console.log('Video', index, 'src:', video.querySelector('source')?.src); |
| 91 | + |
| 92 | + video.addEventListener('loadeddata', function () { |
| 93 | + console.log('Video', index, 'loaded successfully'); |
| 94 | + }); |
| 95 | + |
| 96 | + video.addEventListener('error', function (e) { |
| 97 | + console.error('Video', index, 'error:', e); |
| 98 | + console.error('Video src:', this.querySelector('source')?.src); |
| 99 | + }); |
| 100 | + |
| 101 | + video.load(); |
| 102 | + }); |
| 103 | + |
| 104 | + // Initialize carousel to trigger the first video |
| 105 | + updateCarousel(); |
| 106 | +}); |
| 107 | + |
| 108 | +function updateCarousel() { |
| 109 | + track.style.transform = `translateX(-${currentSlide * 100}%)`; |
| 110 | + |
| 111 | + indicators.forEach((indicator, index) => { |
| 112 | + indicator.classList.toggle('active', index === currentSlide); |
| 113 | + }); |
| 114 | + |
| 115 | + // Play the current video and pause others |
| 116 | + const allVideos = document.querySelectorAll('.carousel-item video'); |
| 117 | + allVideos.forEach((video, index) => { |
| 118 | + if (index === currentSlide) { |
| 119 | + video.play().catch(e => console.log('Video play prevented:', e)); |
| 120 | + } else { |
| 121 | + video.pause(); |
| 122 | + } |
| 123 | + }); |
| 124 | +} |
| 125 | + |
| 126 | +function moveCarousel(direction) { |
| 127 | + currentSlide += direction; |
| 128 | + |
| 129 | + if (currentSlide < 0) { |
| 130 | + currentSlide = totalSlides - 1; |
| 131 | + } else if (currentSlide >= totalSlides) { |
| 132 | + currentSlide = 0; |
| 133 | + } |
| 134 | + |
| 135 | + updateCarousel(); |
| 136 | +} |
| 137 | + |
| 138 | +function goToSlide(index) { |
| 139 | + currentSlide = index; |
| 140 | + updateCarousel(); |
| 141 | +} |
| 142 | + |
| 143 | +// Auto-advance carousel every 5 seconds |
| 144 | +setInterval(() => { |
| 145 | + moveCarousel(1); |
| 146 | +}, 10000); |
| 147 | + |
| 148 | +// Capabilities Deep Dive functionality |
| 149 | +let currentCapability = 0; |
| 150 | +const capabilitiesTrack = document.getElementById('capabilitiesTrack'); |
| 151 | +const capabilityIndicators = document.querySelectorAll('.capability-indicator'); |
| 152 | +const totalCapabilities = document.querySelectorAll('.capability-slide').length; |
| 153 | + |
| 154 | +function updateCapabilities() { |
| 155 | + capabilitiesTrack.style.transform = `translateX(-${currentCapability * 100}%)`; |
| 156 | + |
| 157 | + capabilityIndicators.forEach((indicator, index) => { |
| 158 | + indicator.classList.toggle('active', index === currentCapability); |
| 159 | + }); |
| 160 | +} |
| 161 | + |
| 162 | +function moveCapabilities(direction) { |
| 163 | + currentCapability += direction; |
| 164 | + |
| 165 | + if (currentCapability < 0) { |
| 166 | + currentCapability = totalCapabilities - 1; |
| 167 | + } else if (currentCapability >= totalCapabilities) { |
| 168 | + currentCapability = 0; |
| 169 | + } |
| 170 | + |
| 171 | + updateCapabilities(); |
| 172 | +} |
| 173 | + |
| 174 | +function goToCapability(index) { |
| 175 | + currentCapability = index; |
| 176 | + updateCapabilities(); |
| 177 | +} |
0 commit comments