Responsive Table is a tasty JavaScript library which helps format data tables on small screens! It does so by reordering items in the DOM while keeping HTML markup valid and assistive technology friendly!
Flavours
- – Generates a link list above the table using the row headers as the link text. Only the associated table row is visible while the others remain hidden! List
- – Displays each row of content atop one another, like a stack of pankaces! Stack
- – The table remains as-is with a horizontal scroll available. A link to open the table in a new, full-width window appears at the desired breakpoint. Window
Usage
-
Include
responsive-table.js
at the bottom of your page -
Create a new
dataTable
variable and assign it anew ResponsiveTable()
instance -
Pass
ResponsiveTable()
three paramaters:-
The unique
IDREF
of the table -
The type of table:
list
,stack
, orwindow
- The CSS breakpoint at which the table mutation should occur
-
The unique
<script src="js/responsive-table.js"></script>
<script>
var dataTable = new ResponsiveTable('#data-table', 'list', '50em');
</script>