1// once page has loaded, fade in hero (prevent flash of bg image) 2window.addEventListener('load', function () { 3 document.querySelector('.hero--front').classList.add('active'); 4}); 5 6const images = document.querySelectorAll('.reveal'); 7 8function updateValues() { 9 10 for (let i = 0; i < images.length; i++) { 11 12 let item = images[i]; 13 14 if (item && !item.classList.contains('active')) { 15 if (ScrollTrigger.positionInViewport(item) < .9 && ScrollTrigger.positionInViewport(item) > 0) { 16 switch (i) { 17 case 0: 18 item.classList.add('fade-right'); 19 break; 20 case 1: 21 item.classList.add('fade-left'); 22 break; 23 default: 24 item.classList.add('fade-up'); 25 break; 26 } 27 item.classList.add('active'); 28 } 29 } 30 } 31} 32 33ScrollTrigger.create({ 34 onUpdate: updateValues 35}); 36 37document.addEventListener('DOMContentLoaded', function() { 38 var video = document.getElementById('hero__playback'); 39 var playButton = document.getElementById('playButton'); 40 41 video.muted = true; 42 video.playsInline = true; // Ensure inline playback 43 var playPromise = video.play(); 44 45 if (playPromise !== undefined) { 46 playPromise.then(_ => { 47 // Autoplay started 48 }).catch(error => { 49 // Autoplay was prevented, show play button 50 playButton.classList.remove('hidden'); 51 }); 52 } 53 54 playButton.onclick = function() { 55 video.play(); 56 this.classList.add('fading'); 57 setTimeout(() => { 58 this.classList.add('hidden'); 59 this.classList.remove('fading'); 60 }, 500); // Match this to the transition duration 61 }; 62 63 // Hide controls 64 video.addEventListener('loadedmetadata', function() { 65 this.controls = false; 66 }); 67});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.