From 2fff21dc064a14532116cd68f01c967d47a5aed5 Mon Sep 17 00:00:00 2001 From: Aspectis <tobias@aspectis.net> Date: Fri, 23 Apr 2021 14:38:47 +0200 Subject: [PATCH] refs #19749 [fid_bbi] fix off-canvas search --- themes/fid_bbi/js/theme.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/themes/fid_bbi/js/theme.js b/themes/fid_bbi/js/theme.js index 6ceb067343c..77585b48dd6 100644 --- a/themes/fid_bbi/js/theme.js +++ b/themes/fid_bbi/js/theme.js @@ -9,6 +9,7 @@ const theme = { scrollPos: 0, sidebar: null, + viewportWidth: window.innerWidth, init() { theme.initSelects() @@ -31,6 +32,12 @@ const theme = { // Close open sidebar when viewport size changes window.addEventListener('resize', () => { + if (theme.viewportWidth === window.innerWidth) { + return + } + + theme.viewportWidth = window.innerWidth + if (theme.sidebar && theme.sidebar.classList.contains('-open')) { theme.toggleSidebar() } -- GitLab