Calculates the width of the window's vertical scrollbar.
Window.innerWidth
to get the interior width of the window.Element.clientWidth
to get the inner width of the Document
element.const getScrollbarWidth = () =>
window.innerWidth - document.documentElement.clientWidth;
getScrollbarWidth(); // 15
JavaScript, Browser
Returns an array of HTML elements whose width is larger than that of the viewport's.
JavaScript, Browser
Smoothly scrolls the element on which it's called into the visible area of the browser window.
JavaScript, Browser
Finds the distance from a given element to the top of the document.