hugo-theme-noteworthy/assets/js/main.js

14 lines
419 B
JavaScript
Raw Permalink Normal View History

2020-02-02 17:13:02 +00:00
window.onload = wrapTable();
// Wrap tables in a div so that they scroll responsively.
function wrapTable() {
const tables = document.querySelectorAll('table');
tables.forEach((table) => {
const tableWrapper = document.createElement('div');
tableWrapper.className = 'table-wrapper';
table.parentElement.replaceChild(tableWrapper, table);
tableWrapper.appendChild(table);
});
};