From 9ef458b15d2751f12e8441627c435bfe2ab35c6c Mon Sep 17 00:00:00 2001 From: Chris Mills Date: Mon, 26 Aug 2024 12:56:45 +0100 Subject: [PATCH] Couple of small tweaks --- visual-viewport-api/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/visual-viewport-api/main.js b/visual-viewport-api/main.js index e296483..15390c7 100644 --- a/visual-viewport-api/main.js +++ b/visual-viewport-api/main.js @@ -15,15 +15,15 @@ const scrollendUpdater = () => { }; function updateText() { - visualInfo.innerText = `Visual viewport top: ${visualViewport.offsetTop.toFixed(2)} left: ${visualViewport.offsetLeft.toFixed(2)}`; + visualInfo.innerText = `Visual viewport left: ${visualViewport.offsetLeft.toFixed(2)} top: ${visualViewport.offsetTop.toFixed(2)}`; windowInfo.innerText = `Window scrollX: ${window.scrollX.toFixed(2)} scrollY: ${window.scrollY.toFixed(2)}`; } +updateText(); + visualViewport.onresize = scrollUpdater; visualViewport.onscroll = scrollUpdater; visualViewport.onscrollend = scrollendUpdater; window.onresize = scrollUpdater; window.onscroll = scrollUpdater; window.onscrollend = scrollendUpdater; - -updateText();