Use fixed small/compact nav breakpoint width

This commit is contained in:
Anton Khorev 2024-05-28 06:49:04 +03:00
parent 424316b41c
commit c8757cf1d0

View file

@ -90,13 +90,13 @@ $(document).ready(function () {
// See https://turbo.hotwired.dev/reference/drive#turbo.session.drive // See https://turbo.hotwired.dev/reference/drive#turbo.session.drive
Turbo.session.drive = false; Turbo.session.drive = false;
var headerWidth = 0, let headerWidth = 0;
compactWidth = 0; const breakpointWidth = 768;
function updateHeader() { function updateHeader() {
var windowWidth = $(window).width(); var windowWidth = $(window).width();
if (windowWidth < compactWidth) { if (windowWidth < breakpointWidth) {
$("body").addClass("small-nav"); $("body").addClass("small-nav");
expandSecondaryMenu(); expandSecondaryMenu();
} else if (windowWidth < headerWidth) { } else if (windowWidth < headerWidth) {
@ -142,12 +142,6 @@ $(document).ready(function () {
headerWidth += $(e).outerWidth(); headerWidth += $(e).outerWidth();
}); });
collapseSecondaryMenu();
$("header").children(":visible").each(function (i, e) {
compactWidth += $(e).outerWidth();
});
$("header").removeClass("text-nowrap"); $("header").removeClass("text-nowrap");
$("header nav.secondary > ul").removeClass("flex-nowrap"); $("header nav.secondary > ul").removeClass("flex-nowrap");