1(function() { 2 "use strict"; // Start of use strict 3 4 function initParallax() { 5 6 if (!('requestAnimationFrame' in window)) return; 7 if (/Mobile|Android/.test(navigator.userAgent)) return; 8 9 var parallaxItems = document.querySelectorAll('[data-bss-parallax]'); 10 11 if (!parallaxItems.length) return; 12 13 var defaultSpeed = 0.5; 14 var visible = []; 15 var scheduled; 16 17 window.addEventListener('scroll', scroll); 18 window.addEventListener('resize', scroll); 19 20 scroll(); 21 22 function scroll() { 23 24 visible.length = 0; 25 26 for (var i = 0; i < parallaxItems.length; i++) { 27 var rect = parallaxItems[i].getBoundingClientRect(); 28 var speed = parseFloat(parallaxItems[i].getAttribute('data-bss-parallax-speed'), 10) || defaultSpeed; 29 30 if (rect.bottom > 0 && rect.top < window.innerHeight) { 31 visible.push({ 32 speed: speed, 33 node: parallaxItems[i] 34 }); 35 } 36 37 } 38 39 cancelAnimationFrame(scheduled); 40 41 if (visible.length) { 42 scheduled = requestAnimationFrame(update); 43 } 44 45 } 46 47 function update() { 48 49 for (var i = 0; i < visible.length; i++) { 50 var node = visible[i].node; 51 var speed = visible[i].speed; 52 53 node.style.transform = 'translate3d(0, ' + (-window.scrollY * speed) + 'px, 0)'; 54 } 55 56 } 57 } 58 59 initParallax(); 60})(); // End of use strict 61
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.