PageSourceSearch

https://www.glass.org/modules/custom/nga_settings/js/sticky_navigation.js?tl447n

js glass.org collected 2026-10-01 12:31:03 UTC 1,678 bytes, 55 lines download raw bytes

1import once from 'drupal/once';
2
3(function ($, Drupal, once) {
4
5  function doSomething(context) {
6    // This ensures the code is only run once:
7    once('some-arbitrary-key', '.sticky-selector', context).forEach(function (element) {
8      // Do stuff here. It will only be executed once.
9    });
10  }
11
12  /**
13   * Sticky Navigation
14   */
15  function sticky_navigation(context) {
16    let header_offset = 0;
17    if ($('.toolbar-tray-open.toolbar-horizontal').length === 1 && $(window).width() > 610) {
18      header_offset = 96;
19    } else if ($('.toolbar-fixed').length === 1 && $(window).width() > 930) {
20      header_offset = 40;
21    } else if ($('.toolbar-fixed').length === 1 && $(window).width() > 610) {
22      header_offset = 78;
23    }
24
25    var pos = $(window).scrollTop();
26    var offset_pre = $('#block-ngaeventregistrationblock').offset().top - header_offset;
27    var offset = $('#block-ngaeventregistrationblock').offset().top - header_offset + 1;
28
29    if (pos > offset_pre) {
30      $('body').addClass('fixed-header-start');
31    } else {
32      $('body').removeClass('fixed-header-start');
33    }
34    if (pos > offset) {
35      $('body').addClass('fixed-header').removeClass('fixed-header_dis');
36    } else {
37      $('body').removeClass('fixed-header').addClass('fixed-header_dis');
38    }
39  }
40
41  Drupal.behaviors.someArbitraryKey = {
42    attach: function (context) {
43      once('stickyBehavior', '#banner-button-sticky', context).forEach(function (element) {
44        /**
45         * Sticky Navigation Scroll
46         */
47        $(window).scroll(function () {
48          //Sticky Header
49          sticky_navigation();
50        });
51      });
52    }
53  };
54
55}(jQuery, Drupal, once));

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.