onsa
12/17/2016 - 12:51 AM

Sample usage of Get scrollbar width (https://github.com/brandonaaron/jquery-getscrollbarwidth)

Sample usage of Get scrollbar width (https://github.com/brandonaaron/jquery-getscrollbarwidth)

<html>
	<head>
		<meta http-equiv="Content-type" content="text/html; charset=utf-8">
		<title>jQuery getScrollBarWidth example</title>
		<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="jquery.getScrollbarWidth.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript" charset="utf-8">
			$(function() {
				$('#width').text( $.getScrollbarWidth() );
			});
		</script>
		<style type="text/css" media="screen">
			#example { width: 100px; height: 100px; overflow: auto; }
				#example div { width: 100%; height: 200px; background: #ccc; border: 1px solid #000; }
		</style>
	</head>
	<body>
		<h1>jQuery <code>getScrollbarWidth</code> Snippet Example</h1>
		<p>The scrollbar width is <span id="width"></span></p>
		<div id="example"><div></div></div>
	</body>
</html>