+5
-3
@@ -407,13 +407,15 @@ Promise.all([
|
|||||||
});
|
});
|
||||||
|
|
||||||
let resizeTimer, lastWidth = 0;
|
let resizeTimer, lastWidth = 0;
|
||||||
new ResizeObserver(entries => {
|
function onResize() {
|
||||||
const w = Math.round(entries[0].contentRect.width);
|
const w = document.querySelector('main').clientWidth;
|
||||||
if (w === lastWidth) return;
|
if (w === lastWidth) return;
|
||||||
lastWidth = w;
|
lastWidth = w;
|
||||||
clearTimeout(resizeTimer);
|
clearTimeout(resizeTimer);
|
||||||
resizeTimer = setTimeout(drawCharts, 120);
|
resizeTimer = setTimeout(drawCharts, 120);
|
||||||
}).observe(document.querySelector('main'));
|
}
|
||||||
|
new ResizeObserver(onResize).observe(document.querySelector('main'));
|
||||||
|
addEventListener('resize', onResize);
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user