Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #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.

    #1436146

    Hey beverlystone,
    To restructure the table for mobile view from this:
    Enfold_Support_4894.jpeg
    to this:
    Enfold_Support_4896.jpeg
    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:
    Enfold_Support_4898.jpeg
    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,
    Mike

    #1436180

    This works great for the tables! Thank you.

    Should I open separate threads for the other two issues?

    #1436184

    Hi,
    Glad that this helped, please open separate threads for each issue, thanks for using Enfold.

    Best regards,
    Mike

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Table Stackin on Mobile, Easy Sider Arrows on Mobile, Accordion Sort Not Working’ is closed to new replies.