Formuła wielkości paska przewijania
// For Specific Element
var horizontalScrollbarSize = ((element.offsetWidth / element.scrollWidth) * element.offsetWidth)
var verticalScrollbarSize = ((element.offsetHeight / element.scrollHeight) * element.offsetHeight)
console.log(horizontalScrollbarSize); // Note: This values neglect the height
console.log(verticalScrollbarSize); // or width of the scrollbar arrows
// For Body
var horizontalScrollbarSize = ((document.body.offsetWidth / document.body.scrollWidth) * document.body.offsetWidth)
var verticalScrollbarSize = ((document.body.offsetHeight / document.body.scrollHeight) * document.body.offsetHeight)
console.log(horizontalScrollbarSize); // Note: This values neglect the height
console.log(verticalScrollbarSize); // or width of the scrollbar arrows
Code Rabbi