From ac2919736443a5fbfd5436ba4de7299fd9a27a38 Mon Sep 17 00:00:00 2001 From: billz Date: Mon, 28 Oct 2019 16:28:48 +0000 Subject: [PATCH] Override SB Admin2 sidebarToggle function --- app/js/custom.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/js/custom.js b/app/js/custom.js index df505046..8b32df1a 100644 --- a/app/js/custom.js +++ b/app/js/custom.js @@ -266,15 +266,23 @@ $("#sidebarToggleTopbar").on('click', function(e) { $(".sidebar").toggleClass("d-none"); }); +// Overrides SB Admin 2 +$("#sidebarToggle, #sidebarToggleTop").on('click', function(e) { + var toggled = $(".sidebar").hasClass("toggled"); + // Persist state in cookie + setCookie('sidebar',toggled, 90); +}); + $(function() { if ($(window).width() < 768) { $('.sidebar').addClass('toggled'); } }); -$(window).resize(function() { +$(window).on("load resize",function(e) { if ($(window).width() > 768) { $('.sidebar').removeClass('d-none'); + $('.sidebar').removeClass('d-md-block'); $('.sidebar').removeClass('toggled'); }; });