Last active
January 4, 2017 08:59
-
-
Save SashaKolbasov/0e28651cb21d22ee26b2d865411580c3 to your computer and use it in GitHub Desktop.
Scrollbar Width
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function scrollWidth() { | |
var div = document.createElement('div'); | |
div.style.overflowY = 'scroll'; | |
div.style.width = '50px'; | |
div.style.height = '50px'; | |
div.style.visibility = 'hidden'; | |
document.body.appendChild(div); | |
var s = div.offsetWidth - div.clientWidth; | |
document.body.removeChild(div); | |
return s; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment