Skip to content

Commit

Permalink
Couple of small tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdavidmills committed Aug 26, 2024
1 parent b00cc6c commit 9ef458b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions visual-viewport-api/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

0 comments on commit 9ef458b

Please sign in to comment.