From bcd88f6356e4ad077d49fa3ef7fa9765847f8f1b Mon Sep 17 00:00:00 2001 From: Ewa Gasperowicz Date: Mon, 17 Sep 2018 11:30:06 +0200 Subject: [PATCH] Add fallback to window.onresize --- src/components/Output/custom-els/TwoUp/index.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/Output/custom-els/TwoUp/index.ts b/src/components/Output/custom-els/TwoUp/index.ts index 034a6429..de03e7c8 100644 --- a/src/components/Output/custom-els/TwoUp/index.ts +++ b/src/components/Output/custom-els/TwoUp/index.ts @@ -38,8 +38,12 @@ export default class TwoUp extends HTMLElement { .observe(this, { childList: true }); // Watch for element size changes. - new ResizeObserver(() => this._resetPosition()) - .observe(this); + if (window.hasOwnProperty('ResizeObserver')) { + new ResizeObserver(() => this._resetPosition()) + .observe(this); + } else { + window.addEventListener('resize', () => this._resetPosition()); + } // Watch for pointers on the handle. const pointerTracker: PointerTracker = new PointerTracker(this._handle, {