(nth) { return cellContentHeight(categories[nth]) + cellContentHeight(categories[nth + 4]); } var legendTop = Math.max(columnContentHeight(2), columnContentHeight(3)); var legend = document.querySelector('.legend'); if (legend) { // grid-row-gap: 10px legend.style.top = (legendTop + 10 + 20) + 'px'; } document.querySelector('.dropdown.products-dropdown.initial-hidden').classList.remove('initial-hidden');