views:

43

answers:

1

I have an HTML table that contains lots of rows and columns. Therefore, it has vertical and horizontal scroll bars.

How can I get the dimensions in pixels of these scroll bars in Javascript/jQuerys ?

A: 

Ben Alman has a nice scrollbarWidth plugin that works nicely.

var content = $('#content').css( 'width', 'auto' ),
  container = content.parent();

if ( content.height() > container.height() ) {
  content.width( content.width() - $.scrollbarWidth() );
}
PetersenDidIt