forked from CCCHH/hacker.tours-website
Initial version
This commit is contained in:
commit
ed5653a7fc
211 changed files with 11043 additions and 0 deletions
29
themes/zen/assets/js/tables.js
Normal file
29
themes/zen/assets/js/tables.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
* @file
|
||||
* A JavaScript file for responsive tables.
|
||||
*/
|
||||
|
||||
/* eslint-disable max-nested-callbacks */
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
const tables = document.querySelectorAll('.responsive-table');
|
||||
|
||||
tables.forEach(function (table) {
|
||||
const headers = table.querySelectorAll('th');
|
||||
const rows = table.querySelectorAll('tbody tr');
|
||||
|
||||
rows.forEach(function (row) {
|
||||
const cells = row.querySelectorAll('td');
|
||||
|
||||
cells.forEach(function (cell, i) {
|
||||
cell.setAttribute('role','cell');
|
||||
if (headers[i].innerText) {
|
||||
cell.setAttribute('aria-label', headers[i].innerText);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue