Common Use-Case: Overflow Scrolling
The table header sticks around as you scroll within a container. This is done via absolute positioning it there, you can change it to use fixed positioning if you set position to 'fixed'.
Absolute positioning is a good default because you do not need to call $table.floatThead("reflow") if the table's position changes because of some changes in the DOM
$('table').floatThead({
scrollingTop: pageTop,
useAbsolutePositioning: true,
scrollContainer: function($table){
return $table.closest(".wrapper");
}
});
Re-initialize plugin with fixed positioning
floated header is using position:absolute
| | |
| Cell Content 1 | Cell Content 2 | Cell Content 3 |
| More Cell Content 1 | More Cell Content 2 | More Cell Content 3 |
| Even More Cell Content 1 | Even More Cell Content 2 | Even More Cell Content 3 |
| And Repeat 1 | And Repeat 2 | And Repeat 3 |
| Cell Content 1 | Cell Content 2 | Cell Content 3 |
| More Cell Content 1 | More Cell Content 2 | More Cell Content 3 |
| Even More Cell Content 1 | Even More Cell Content 2 | Even More Cell Content 3 |
| And Repeat 1 | And Repeat 2 | And Repeat 3 |
| Cell Content 1 | Cell Content 2 | Cell Content 3 |
| More Cell Content 1 | More Cell Content 2 | More Cell Content 3 |
| Even More Cell Content 1 | Even More Cell Content 2 | Even More Cell Content 3 |
| And Repeat 1 | And Repeat 2 | And Repeat 3 |
| Cell Content 1 | Cell Content 2 | Cell Content 3 |
| More Cell Content 1 | More Cell Content 2 | More Cell Content 3 |
| Even More Cell Content 1 | Even More Cell Content 2 | Even More Cell Content 3 |
| And Repeat 1 | And Repeat 2 | And Repeat 3 |
| Cell Content 1 | Cell Content 2 | Cell Content 3 |
| More Cell Content 1 | More Cell Content 2 | More Cell Content 3 |
| Even More Cell Content 1 | Even More Cell Content 2 | Even More Cell Content 3 |