I am currently trying to fix my first column in a table when the user scrolls in the X-axis. I am using this structure:
SOLVED
http://jsfiddle.net/DJqPf/7/
.table-wrapper {
overflow-x:scroll;
overflow-y:visible;
width:250px;
margin-left: 120px;
}
td, th {
padding: 5px 20px;
width: 100px;
}
th:first-child {
position: fixed;
left: 5px
}
UPDATE
$(function () {
$('.table-wrapper tr').each(function () {
var tr = $(this),
h = 0;
tr.children().each(function () {
var td = $(this),
tdh = td.height();
if (tdh > h) h = tdh;
});
tr.css({height: h + 'px'});
});
});
body {
position: relative;
}
.table-wrapper {
overflow-x:scroll;
overflow-y:visible;
width:200px;
margin-left: 120px;
}
td, th {
padding: 5px 20px;
width: 100px;
}
tbody tr {
}
th:first-child {
position: absolute;
left: 5px
}
JS Bin
SOME RANDOM TEXT
Month
Item 1
Item 2
Item 3
Item 4
Jan is an awesome month
3163
3163
3163
3163
Feb
3163
3163
3163
3163
Mar
3163
3163
3163
3163
Apr
3163
3163
3163
3163
May
3163
3163
3163
3163
Jun
3163
3163
3163
3163
...
...
...
...
...