PageSourceSearch

https://www.info.diva-portal.org/download/18.707c43a6199c2dbaa2c41…/1759997482243/calculate-scrollbar-width.js

js diva-portal.org collected 2026-09-24 07:19:41 UTC 500 bytes, 13 lines download raw bytes

1function setScrollbarWidthVariable() {
2  // window.innerWidth = viewport including scrollbars
3  // documentElement.clientWidth = viewport excluding scrollbars
4  const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
5
6  // Set as CSS variable on <html> (root)
7  document.documentElement.style.setProperty("--scrollbar-width", `${scrollbarWidth}px`);
8}
9
10// Run on load
11setScrollbarWidthVariable();
12// Run on resize
13window.addEventListener("resize", setScrollbarWidthVariable);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.