From 2792c7fc6bbd63824b4c342f81f757154cdc59c6 Mon Sep 17 00:00:00 2001 From: FANGKK Date: Thu, 10 Sep 2026 17:19:56 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AA=97=E5=8F=A3=20resize=20=E5=85=9C?= =?UTF-8?q?=E5=BA=95=E9=87=8D=E7=BB=98=E5=9B=BE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5 --- index.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 13e4b6a..f4dd5ef 100644 --- a/index.html +++ b/index.html @@ -407,13 +407,15 @@ Promise.all([ }); let resizeTimer, lastWidth = 0; -new ResizeObserver(entries => { - const w = Math.round(entries[0].contentRect.width); +function onResize() { + const w = document.querySelector('main').clientWidth; if (w === lastWidth) return; lastWidth = w; clearTimeout(resizeTimer); resizeTimer = setTimeout(drawCharts, 120); -}).observe(document.querySelector('main')); +} +new ResizeObserver(onResize).observe(document.querySelector('main')); +addEventListener('resize', onResize);