PageSourceSearch

https://www.damopen.com/themes/custom/brainsum_theme/js/parallax.js?v=2.6.1

js damopen.com collected 2026-09-30 18:10:53 UTC 1,338 bytes, 38 lines download raw bytes

1/**
2 * @file
3 * Parallax js for NBS parallax paragraph.
4 * Author Adam Herczeg.
5 *
6 */
7
8($ => {
9  function isInViewport(node) {
10    const rect = node.getBoundingClientRect();
11    return (rect.height > 0 || rect.width > 0) && rect.bottom >= 0 && rect.right >= 0 && rect.top <= (window.innerHeight || document.documentElement.clientHeight) && rect.left <= (window.innerWidth || document.documentElement.clientWidth);
12  }
13  $(window).scroll(() => {
14    const scrolled = $(window).scrollTop();
15    $('.paragraph--type--parallax').each(function elementParallaxCalc() {
16      const initY = $(this).offset().top;
17      const height = $(this).height();
18      // const endY = initY + $(this).height();
19      let diff;
20      let ratio;
21      // let amount = 0;
22      const st = $(this).scrollTop();
23      const lastScrollTop = st;
24      const visible = isInViewport(this);
25      if (visible) {
26        diff = scrolled - initY;
27        ratio = Math.round(diff / height * 100);
28        // amount += parseInt(-(ratio * 1) - 200, 10);
29        diff = -diff / 3;
30        $(this).find('.bg-image').css('background-position', `center ${ratio / 1.2}px`);
31      } else if (st > lastScrollTop) {
32        // down scroll code
33      } else {
34        $(this).find('.bg-image').css('background-position', `center ${0}px`);
35      }
36    });
37  });
38})(jQuery, Drupal);

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.