Scroll fix

This commit is contained in:
Tanya Fomina 2022-04-07 01:01:45 +08:00
parent 085da8e09a
commit 82deae543e
2 changed files with 15 additions and 1 deletions

View file

@ -269,6 +269,14 @@ export default class UI extends Module<UINodes> {
this.isMobile = window.innerWidth < 650; this.isMobile = window.innerWidth < 650;
} }
/**
* Updates --vh variable value, which allows to calculate actual 100vh value for mobile browsers
*/
private setAppHeightFraction(): void {
const doc = document.documentElement
doc.style.setProperty('--vh', (window.innerHeight * 0.01) + 'px');
}
/** /**
* Makes Editor.js interface * Makes Editor.js interface
*/ */
@ -437,6 +445,11 @@ export default class UI extends Module<UINodes> {
* Detect mobile version * Detect mobile version
*/ */
this.checkIsMobile(); this.checkIsMobile();
/**
* Updates stored window height fraction
*/
this.setAppHeightFraction();
} }
/** /**

View file

@ -129,7 +129,8 @@
} }
.ce-scroll-locked, .ce-scroll-locked > body { .ce-scroll-locked, .ce-scroll-locked > body {
height: 100vh; height: 100vh; /* Fallback for browsers that do not support Custom Properties */
height: calc(var(--vh) * 100);
overflow: hidden; overflow: hidden;
/** /**
* Mobile Safari fix * Mobile Safari fix