PageSourceSearch

https://codingdavinci.de/theme/relaunch2018/js/menu.js

js codingdavinci.de collected 2026-10-02 03:24:05 UTC 2,295 bytes, 80 lines download raw bytes

1/**
2* DO NOT EDIT THIS FILE.
3* See the following change record for more information,
4* https://www.drupal.org/node/2815083
5* @preserve
6**/
7
8(function ($) {
9  $(function () {
10    var $primaryMenu = $('.region-primary-menu');
11
12    considerAdminToolbarOffset($primaryMenu);
13    initAnimations($primaryMenu);
14  });
15
16  function initAnimations($primaryMenu) {
17    var $toggler = $('.navbar-toggler');
18    var $menu = $('#mainMenu');
19    var $menuContainer = $menu.closest('.navbar--menu');
20
21    $primaryMenu.find('.dropdown-toggle').on('click', function (e) {
22      return e.preventDefault();
23    }).parent().on('show.bs.dropdown hide.bs.dropdown', function (e) {
24      $(this).find('.dropdown-menu').stop(true)[e.type === 'show' ? 'slideDown' : 'slideUp']({
25        duration: 'fast',
26        easing: 'easeInOutCirc'
27      });
28    });
29
30    $menu.on('show.bs.collapse hide.bs.collapse', function (e) {
31      var show = e.type === 'show';
32
33      $toggler.toggleClass('collapsed', !show).attr('aria-expanded', show);
34
35      $menuContainer.toggleClass('show', show);
36
37      updateMenuItemTransitionDelays($menu, !show);
38    });
39
40    updateMenuItemTransitionDelays($menu, false);
41  }
42
43  function updateMenuItemTransitionDelays($menu, isShown) {
44    $menu.find('.menu > li').each(function (i) {
45      $(this).css('transition-delay', (isShown ? 0 : i * 0.05) + 's');
46    });
47  }
48
49  function considerAdminToolbarOffset($primaryMenu) {
50    var $body = $('body');
51
52    if ($body.hasClass('toolbar-horizontal') || $body.hasClass('toolbar-vertical')) {
53      var $navbar = $primaryMenu.find('.navbar.fixed-top');
54      setPositions($navbar);
55
56      $(window).on('resize', function () {
57        return setPositions($navbar);
58      });
59    }
60  }
61
62  function setPositions($elements) {
63    $elements.each(function () {
64      var isFixed = $(this).css('position') === 'fixed';
65      var $this = $(this);
66
67      $this.css('position', 'absolute');
68
69      if (typeof $this.data('relaunch2018-menu-position-top') === 'undefined') {
70        $this.data('relaunch2018-menu-position-top', $this.position().top);
71      }
72
73      $this.css('top', $this.data('relaunch2018-menu-position-top') + parseFloat($('body').css('paddingTop')));
74
75      if (isFixed) {
76        $this.css('position', 'fixed');
77      }
78    });
79  }
80})(jQuery);

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.