Set Height limiter.
This commit is contained in:
@@ -1,18 +1,19 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const heightLimit = window.outerHeight * 2;
|
||||||
let height = getCurrentHeight();
|
let height = getCurrentHeight();
|
||||||
setupResizeListener();
|
setupResizeListener();
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|
||||||
function setupResizeListener() {
|
function setupResizeListener() {
|
||||||
const resizeObserver = new ResizeObserver((entries) => setTimeout(handleHeightChange, 100));
|
const resizeObserver = new ResizeObserver(handleHeightChange);
|
||||||
resizeObserver.observe(document.body);
|
resizeObserver.observe(document.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleHeightChange(entries) {
|
function handleHeightChange(entries) {
|
||||||
const updatedHeight = getCurrentHeight();
|
const updatedHeight = getCurrentHeight();
|
||||||
if (height === updatedHeight) {
|
if (height === updatedHeight || updatedHeight > heightLimit) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user