PageSourceSearch

https://www.nestlehealthscience.com.hk/themes/custom/nhsc_com/js/parallax.js?tmh1r4

js nestlehealthscience.com.hk collected 2026-10-06 07:59:12 UTC 3,197 bytes, 107 lines download raw bytes

1/**
2 * @file
3 * JavaScript behaviors for Parallax integration.
4 */
5
6(function ($, Drupal) {
7  'use strict';
8  Drupal.behaviors.parallax = {
9    attach: function (context, settings) {
10      $(once('parallax', '.parallax-section')).each(function () {
11        var $context = $(context);
12
13        if ($context.find('.parallax-section').length) {
14
15          const scroller = scrollama();
16
17          scroller
18            .setup({
19              step: ".parallax-item",
20              offset: 0.5
21            })
22
23            .onStepEnter((response) => {
24              var el = response.element;
25              var index = response.index;
26              parallaxSection.style.background = el.dataset.colour;
27              $('#parallaxNavigation li').removeClass("active");
28              $('#parallaxNavigation li').eq(index).addClass("active");
29            })
30          // setup resize event
31          window.addEventListener("resize", scroller.resize);
32
33          if (document.body.clientWidth > 992) {
34            lax.init()
35
36            // Add a driver that we use to control our animations
37            lax.addDriver('scrollY', function () {
38              return window.scrollY
39            })
40
41            // Add animation bindings to elements
42            lax.addElements('.parallax-item-heading', {
43              scrollY: {
44                translateY: [
45                  ['elInY', 'elOutY'],
46                  {
47                    768: [0, 0], // Screen width < 500
48                    992: [0, -300], // Screen width > 500 and < 900
49                    1400: [0, -500], // Screen width > 900
50                  }
51                ]
52              }
53            })
54            lax.addElements('.parallax-item-body', {
55              scrollY: {
56                translateY: [
57                  ['elInY', 'elOutY'],
58                  {
59                    768: [0, 0], // Screen width < 500
60                    992: [0, -420], // Screen width > 500 and < 900
61                    1400: [0, -680], // Screen width > 900
62                  },
63                  {
64                    inertia: 8
65                  }
66                ]
67              }
68            })
69            lax.addElements('.parallax-item-image-first', {
70              scrollY: {
71                translateY: [
72                  ['elInY', 'elCenterY'],
73                  [120, 0]
74                ]
75              }
76            })
77            // lax.addElements('.parallax-item-image-first img', {
78            //   scrollY: {
79            //     translateY: [
80            //       ['elInY', 'elCenterY'],
81            //       [300, 0]
82            //     ]
83            //   }
84            // })
85
86            lax.addElements('.parallax-item-image-last', {
87              scrollY: {
88                translateY: [
89                  ['elInY', 'elCenterY'],
90                  [-120, 0]
91                ]
92              }
93            })
94            // lax.addElements('.parallax-item-image-last img', {
95            //   scrollY: {
96            //     translateY: [
97            //       ['elInY', 'elCenterY'],
98            //       [-250, 0]
99            //     ]
100            //   }
101            // })
102          }
103        }
104      });
105    }
106  }
107})(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.