Table with scroll bars

I've been playing around trying to get a jQuery function to work, and it seems to work OK, however I'm having massive difficulty trying to get the columns to match up.

JSFiddle

I've set the columns to a fixed width, but they still seem to not line up.

Can someone please have a look and tell me where Im going wrong with the line up please?

Thank you
tonelm54Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Tom BeckCommented:
I think you need some css. I also made some minor modifications to the script.

http://jsfiddle.net/x6tTR/2/
tonelm54Author Commented:
I think CSS is the issue, however the code that you posted still has the columns are still going off :-(
Tom BeckCommented:
What browser/version are you using?
Tom BeckCommented:
I would like to suggest a different approach.

What you have created will be problematic because you cannot predict how much width to allow for the scroll bar. Even if you get it right for one browser, it will be a little off for another. Table columns will line up differently with the header columns from one browser to the next.

What I suggest is to create two complete copies of the original table. Set the height of the first copy's div wrapper (which becomes the header row) to the height of one row. Set overflow to hidden to hide all other rows. Place it at the top of a parent div that I'll call #wrapper. Wrapper has a fixed height (I set it to 125px).

For the second table copy, set the height of it's parent div (I set it to100px), set overflow to scroll, remove the first row, and place the whole thing below the header row inside the same parent #wrapper.

I'm using jQuery methods that make the coding much more compact. I hope that's not too forward of me. I know how it is when you are trying to learn and someone throws a lot of new  techniques at you all at once.

I'm not in a position to test this in any browser on a Windows machine but it works well in Firefox and Chrome on a Mac.

http://jsfiddle.net/x6tTR/10/

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.