From 9b7759ff37b5bad243779b73abadcef87bc1f47e Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Mon, 28 Feb 2022 17:20:55 -0800 Subject: [PATCH] Add responsive offcanvas classes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Updates navbar-expand classes to de-dupe some styles—these shouldn't interfere now. - Adds some JS to the offcanvas component to help with responsiveness Co-Authored-By: GeoSot --- js/src/offcanvas.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/js/src/offcanvas.js b/js/src/offcanvas.js index 0ae5dbfda..359a024f3 100644 --- a/js/src/offcanvas.js +++ b/js/src/offcanvas.js @@ -206,6 +206,14 @@ class Offcanvas extends BaseComponent { this.hide() }) + + EventHandler.on(window, 'resize', () => { + // Add this check to help js be aligned with css changes on responsive offcanvas + if (this._isShown && getComputedStyle(this._element).position !== 'fixed') { + // this._backdrop.hide() + this.hide() + } + }) } // Static