Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

formula for scrollbar size

// 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
Comment

PREVIOUS NEXT
Code Example
Javascript :: install latest electron 
Javascript :: google sheets api javascript 
Javascript :: Creating a Node.js MySQL Database 
Javascript :: electron check if file exists 
Javascript :: axios get data 
Javascript :: ajax upload image 
Javascript :: float to currency js 
Javascript :: typeof 
Javascript :: javascript timeout 
Javascript :: cypress command return value into variable 
Javascript :: count json objects 
Javascript :: js how to reverse a string 
Javascript :: javascript eval passing variable 
Javascript :: jquery when iframe is loaded 
Javascript :: smooth scroll mouse wheel javascript 
Javascript :: get an array with unique values 
Javascript :: run a while loop for certain time javascript 
Javascript :: angular ngfor counter 
Javascript :: javascript test if string starts with alphabet 
Javascript :: how to show 1 to 10 odd numbers in javascript 
Javascript :: how to pass data between components in react 
Javascript :: how to remove an object from array in react native 
Javascript :: js check if div have another div 
Javascript :: react password hashing 
Javascript :: angularjs round to 2 decimal places input 
Javascript :: express middleware logging 
Javascript :: bun create react app 
Javascript :: how to use the onload event n vue js 
Javascript :: set dynamic route in link react js 
Javascript :: immediately invoked function expression async 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =