Skip to content

Instantly share code, notes, and snippets.

@SashaKolbasov
Last active January 4, 2017 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SashaKolbasov/0e28651cb21d22ee26b2d865411580c3 to your computer and use it in GitHub Desktop.
Save SashaKolbasov/0e28651cb21d22ee26b2d865411580c3 to your computer and use it in GitHub Desktop.
Scrollbar Width
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