mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 13:03:45 +08:00
FIX: consistent narrow desktop width (#19232)
- use client rect instead of innerWidth to determine if screen is narrow - disable _animate when exit mobile/narrow view
This commit is contained in:
parent
7c75b5b100
commit
787655e276
|
@ -367,9 +367,7 @@ const SiteHeaderComponent = MountWidget.extend(
|
|||
const menuPanels = document.querySelectorAll(".menu-panel");
|
||||
|
||||
if (menuPanels.length === 0) {
|
||||
if (this.site.mobileView || this.site.narrowDesktopView) {
|
||||
this._animate = true;
|
||||
}
|
||||
this._animate = this.site.mobileView || this.site.narrowDesktopView;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@ const NarrowDesktop = {
|
|||
|
||||
init() {
|
||||
this.narrowDesktopView =
|
||||
narrowDesktopForced || this.isNarrowDesktopView(window.innerWidth);
|
||||
narrowDesktopForced ||
|
||||
this.isNarrowDesktopView(document.body.getBoundingClientRect().width);
|
||||
},
|
||||
|
||||
isNarrowDesktopView(width) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user