N
Nuxt6mo ago
SpiKe.

How to calculate scrollbar width before elements are visible ?

Hi everyone, I am trying to determine the user's scrollbar width by calculating window.innerWidth - document.body.clientWidth. However, when I use the app:beforeMount hook, this code executes after the DOM has been rendered and the first elements are already visible. Is there a way to execute this calculation before any elements become visible? Thank you!
2 Replies
localhostess
localhostess6mo ago
i do know that if you need the scrollbar not to affect the layout, look into the new css property scrollbar-gutter: stable
Josh Donnell
Josh Donnell6mo ago
@SpiKe.
No description
Want results from more Discord servers?
Add your server