PageSourceSearch

https://www.gamikaze.ch/includes/scripts/parallax.js?v=1

js gamikaze.ch collected 2026-09-29 07:10:55 UTC 1,021 bytes, 30 lines download raw bytes

1/* Parallax Effects */
2(() => {
3  const wraps = Array.from(document.querySelectorAll('.parallax'));
4  if (!wraps.length) return;
5
6  const reduce = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
7  let raf = null;
8
9  function tick() {
10    const vh = window.innerHeight;
11    wraps.forEach(wrap => {
12      const layer = wrap.querySelector('.parallax-layer');
13      if (!layer) return;
14      const speed = Number(wrap.dataset.speed) || 0.3;
15      const rect = wrap.getBoundingClientRect();
16      // Verschiebe nach Verhältnis der Abschnittsmitte zur Viewportmitte
17      const centerDelta = rect.top + rect.height / 2 - vh / 2;
18      const y = reduce ? 0 : -centerDelta * speed;
19      layer.style.setProperty('--py', y.toFixed(1) + 'px');
20    });
21    raf = null;
22  }
23  const onScroll = () => { if (!raf) raf = requestAnimationFrame(tick); };
24
25  // Initial + Events
26  tick();
27  window.addEventListener('scroll', onScroll, { passive: true });
28  window.addEventListener('resize', tick, { passive: true });
29})();
30

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.