1// This script requires jQuery 2 3// Set up carousels 4function handleGameCarouselChange (index) { 5 heroCarousel.goToIndex(index); 6} 7 8function handleHeroCarouselChange (index, previousIndex) { 9 previousIndex = previousIndex || 0; 10 gameCarousel.goToIndex(index); 11 12 const videoElements = document.querySelectorAll('#hero-carousel video'); 13 const videoToStop = videoElements[previousIndex]; 14 const videoToPlay = videoElements[index]; 15 16 if (videoToStop) { 17 videoToStop.pause(); 18 } 19 if (videoToPlay) { 20 videoToPlay.currentTime = 0; 21 videoToPlay.play(); 22 } 23} 24 25const gameCarousel = new Carousel('#game-carousel', { 26 onChange: handleGameCarouselChange 27}); 28const heroCarousel = new Carousel('#hero-carousel', { 29 autoAdvance: 5 * 1000, 30 onChange: handleHeroCarouselChange 31}); 32 33// sometimes mobile devices don't acknowledge "autoplay", so... 34$(function () { 35 const firstVideoElement = document.querySelectorAll('#hero-carousel video')[0]; 36 firstVideoElement.play(); 37});
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.