mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-14 09:39:15 +00:00
Add fallback to window.onresize
This commit is contained in:
@@ -38,8 +38,12 @@ export default class TwoUp extends HTMLElement {
|
|||||||
.observe(this, { childList: true });
|
.observe(this, { childList: true });
|
||||||
|
|
||||||
// Watch for element size changes.
|
// Watch for element size changes.
|
||||||
new ResizeObserver(() => this._resetPosition())
|
if (window.hasOwnProperty('ResizeObserver')) {
|
||||||
.observe(this);
|
new ResizeObserver(() => this._resetPosition())
|
||||||
|
.observe(this);
|
||||||
|
} else {
|
||||||
|
window.addEventListener('resize', () => this._resetPosition());
|
||||||
|
}
|
||||||
|
|
||||||
// Watch for pointers on the handle.
|
// Watch for pointers on the handle.
|
||||||
const pointerTracker: PointerTracker = new PointerTracker(this._handle, {
|
const pointerTracker: PointerTracker = new PointerTracker(this._handle, {
|
||||||
|
|||||||
Reference in New Issue
Block a user