From 178256973104fbc7fab847d3ea6683a2fcfa6e3b Mon Sep 17 00:00:00 2001 From: sbagdaulet <34067738+sbagdaulet@users.noreply.github.com> Date: Fri, 31 May 2019 14:31:33 +0600 Subject: [PATCH] Hide navigation menu in mobile In the mobile with the menu open, the page itself is too narrow. Therefore, I propose to close the navigation menu. Intuitively, it opens due to the presence of a burger. And closing does not look so intuitive as in most other sites and applications the navigation menu is initially hidden --- js/sb-admin-2.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/js/sb-admin-2.js b/js/sb-admin-2.js index 9e96613..b0412d1 100644 --- a/js/sb-admin-2.js +++ b/js/sb-admin-2.js @@ -15,6 +15,13 @@ if ($(window).width() < 768) { $('.sidebar .collapse').collapse('hide'); }; + + // Toggle the side navigation when window is resized below 480px + if ($(window).width() < 480 && !$(".sidebar").hasClass("toggled")) { + $("body").addClass("sidebar-toggled"); + $(".sidebar").addClass("toggled"); + $('.sidebar .collapse').collapse('hide'); + }; }); // Prevent the content wrapper from scrolling when the fixed side navigation hovered over