PageSourceSearch

https://nfcw.nl/wp-content/themes/vedder/js/mega-menu.js

js nfcw.nl collected 2026-10-07 07:10:16 UTC 2,421 bytes, 89 lines download raw bytes

1jQuery(document).ready(function ($) {
2  function isMobile() {
3    return window.innerWidth <= 768;
4  }
5
6  function updateNavProductsLink() {
7    const $link = $(".navProducts > a");
8    const lang = $("html").attr("lang");
9
10    let productsUrl = "/producten/";
11    if (lang === "de-DE") {
12      productsUrl = "/produkte/";
13    }
14
15    if (isMobile()) {
16      // Enable Bootstrap Offcanvas
17      $link
18        .attr("data-bs-toggle", "offcanvas")
19        .attr("href", "#offcanvasProducts")
20        .attr("role", "button")
21        .attr("aria-controls", "offcanvasProducts");
22
23      // Remove desktop hover events
24      $(".navProducts, #navProducts").off("mouseenter mouseleave");
25    } else {
26      // Reset link to normal desktop behavior
27      $link
28        .removeAttr("data-bs-toggle")
29        .attr("href", productsUrl)
30        .removeAttr("role")
31        .removeAttr("aria-controls");
32
33      // Set up hover behavior for desktop
34      $(".navProducts").hover(
35        function () {
36          $("#navProducts").stop(true, true).fadeIn(200).addClass("show");
37        },
38        function () {
39          setTimeout(() => {
40            if (!$("#navProducts:hover").length) {
41              $("#navProducts")
42                .stop(true, true)
43                .fadeOut(200)
44                .removeClass("show");
45            }
46          }, 100);
47        }
48      );
49
50      $("#navProducts").hover(
51        function () {
52          $(this).stop(true, true).fadeIn(200).addClass("show");
53        },
54        function () {
55          $(this).stop(true, true).fadeOut(200).removeClass("show");
56        }
57      );
58    }
59  }
60
61  // Initial run
62  updateNavProductsLink();
63
64  // Run on window resize
65  $(window).on("resize", function () {
66    updateNavProductsLink();
67  });
68});
69
70// Makes the 'return' button functional for the offcanvas menu.
71jQuery(document).ready(function ($) {
72  $("#offcanvasProductsLabel").on("click", function () {
73    var $current = $("#offcanvasProducts");
74    var $prev = $("#offcanvasMenu");
75
76    var currentInstance = bootstrap.Offcanvas.getInstance($current[0]);
77    var prevInstance = bootstrap.Offcanvas.getInstance($prev[0]);
78
79    if (!prevInstance) {
80      prevInstance = new bootstrap.Offcanvas($prev[0]);
81    }
82
83    if (currentInstance) {
84      currentInstance.hide();
85      prevInstance.show();
86    }
87  });
88});
89

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.