Reputation: 4437
I have a table that is too large to be a liquid style element for mobile. My solution was to make the overflow-x: auto
. Works great and is pretty much how spread sheets on mobile apps work. One problem, the table can be confusing to read with the header being within the offset-y
portion. I sometimes find myself scrolling back up just to see what column of data I'm looking at.
Is there a way to keep the table header in a fixed position within the table itself using CSS/JS - jQuery
so that when the user is scrolling through the data, the header is always showing just like you would expect it to be in a mobile app? (Numbers for mac also does this). I don't mind using CSS3 since this is for mobile.
I just want to make sure you guys know what I'm talking about because I couldn't find anything similar to what I wanted to do. Not sure If I'm typing in the wrong search terms or what. But it's pretty much a hybrid style between float
and fixed
.
Upvotes: 1
Views: 176
Reputation: 3589
Code drops has an excellent article on making the table headers fixed while scrolling.
The solution is based on JQuery and it works for both, row heading and column heading
Sticky Table Headers & Columns
Upvotes: 2
Reputation: 824
This is what you're looking for: https://css-tricks.com/persistent-headers/
It's been done many times before.
Upvotes: 2