Tagged: Accordion Sort, Easy Sider Arrows, mobile, table
-
AuthorPosts
-
March 1, 2024 at 1:58 am #1435929
I have three items that I’ve demonstrated on the page in the private area:
1) Tables don’t work well on mobile. the headers stack first and then the data cells. Can this be fixed?
2) On our French website, the accordion sort option isn’t working. It does on the English website.
3) On mobile, the arrows on the easy slider sometimes cover the words, Can this be improved? If not, I can remove the arrows.March 3, 2024 at 5:50 pm #1436146Hey beverlystone,
To restructure the table for mobile view from this:

to this:

I added this javascript to your WP Code plugin as a new snippet, and in the top right corner I used the javascript snippet as the code type:

and then saved.document.addEventListener("DOMContentLoaded", function() { function restructureTableForMobile() { var screenWidth = window.innerWidth; var tables = document.querySelectorAll('tbody'); if (screenWidth <= 767 && tables.length > 0) { tables.forEach(function(table) { var rows = table.querySelectorAll('tr'); var newTableStructure = document.createDocumentFragment(); var columns = rows[0].children.length; for (let colIndex = 0; colIndex < columns; colIndex++) { var newRow = document.createElement('tr'); rows.forEach(function(row, rowIndex) { var cell = row.children[colIndex].cloneNode(true); newRow.appendChild(cell); }); newTableStructure.appendChild(newRow); } table.innerHTML = ''; table.appendChild(newTableStructure); }); } } restructureTableForMobile(); window.addEventListener('resize', restructureTableForMobile); });This will also work for multiple tables on the page, so I added another table to demonstrate, please check.
Best regards,
MikeMarch 3, 2024 at 10:05 pm #1436180This works great for the tables! Thank you.
Should I open separate threads for the other two issues?
March 3, 2024 at 10:33 pm #1436184 -
AuthorPosts
- The topic ‘Table Stackin on Mobile, Easy Sider Arrows on Mobile, Accordion Sort Not Working’ is closed to new replies.
