From c8757cf1d00836a34e8aa3e1244b3a0694914dc2 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Tue, 28 May 2024 06:49:04 +0300 Subject: [PATCH] Use fixed small/compact nav breakpoint width --- app/assets/javascripts/application.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 005ab6217..c6d7c4fe3 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -90,13 +90,13 @@ $(document).ready(function () { // See https://turbo.hotwired.dev/reference/drive#turbo.session.drive Turbo.session.drive = false; - var headerWidth = 0, - compactWidth = 0; + let headerWidth = 0; + const breakpointWidth = 768; function updateHeader() { var windowWidth = $(window).width(); - if (windowWidth < compactWidth) { + if (windowWidth < breakpointWidth) { $("body").addClass("small-nav"); expandSecondaryMenu(); } else if (windowWidth < headerWidth) { @@ -142,12 +142,6 @@ $(document).ready(function () { headerWidth += $(e).outerWidth(); }); - collapseSecondaryMenu(); - - $("header").children(":visible").each(function (i, e) { - compactWidth += $(e).outerWidth(); - }); - $("header").removeClass("text-nowrap"); $("header nav.secondary > ul").removeClass("flex-nowrap"); -- 2.39.5