]> git.openstreetmap.org Git - rails.git/commitdiff
Use fixed small/compact nav breakpoint width
authorAnton Khorev <tony29@yandex.ru>
Tue, 28 May 2024 03:49:04 +0000 (06:49 +0300)
committerAnton Khorev <tony29@yandex.ru>
Wed, 12 Feb 2025 12:36:24 +0000 (15:36 +0300)
app/assets/javascripts/application.js

index 005ab62175b7080faa5eb128a84f6f1d778682e3..c6d7c4fe3b8aafdaf12498e191fcc5c60c0e01f5 100644 (file)
@@ -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");