require(['jquery'], function ($) { $(function () { var BREAKPOINT = 640; var isMobile = $(window).width() < BREAKPOINT; function updateAccessibility() { isMobile = $(window).width() < BREAKPOINT; $(".footer-nav_title a[role='button']").each(function (index) { var $button = $(this); var listId = $button.attr("aria-controls"); var $list = $("#" + listId); if (isMobile) { $button.attr("aria-expanded", index === 1 ? "true" : "false"); $list.attr("aria-hidden", index === 1 ? "false" : "true"); $list.css("display", index === 1 ? "flex" : "none"); } else { $button.attr("aria-expanded", "true"); $list.attr("aria-hidden", "false"); $list.css("display", "flex"); } }); } function toggleMenu(event) { if (!isMobile) return; var $button = $(event.currentTarget); var listId = $button.attr("aria-controls"); var $list = $("#" + listId); var isExpanded = $button.attr("aria-expanded") === "true"; $button.attr("aria-expanded", isExpanded ? "false" : "true"); $list.attr("aria-hidden", isExpanded ? "true" : "false"); $list.css("display", isExpanded ? "none" : "flex"); } $(".footer-nav_title a[role='button']") .on("click", toggleMenu) .on("keydown", function (event) { if (event.key === "Enter" || event.key === " ") { event.preventDefault(); toggleMenu(event); } }); updateAccessibility(); $(window).on("resize", updateAccessibility); }); });