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 });
|
||||
|
||||
// Watch for element size changes.
|
||||
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, {
|
||||
|
||||
Reference in New Issue
Block a user