`; document.body.appendChild($overlay); $overlay.addEventListener('click', function (e) { document.body.removeChild($overlay); }); } }); const $showMores = document.querySelectorAll('.show-more'); const $tags = document.querySelectorAll('.tags'); const maxHeight = window.innerWidth > 768 ? "26px" : "62px"; $showMores?.forEach(($showMore, i) => { const $showMoreSvg = $showMore.querySelector('svg'); $showMore.addEventListener('click', function (e) { $showMoreSvg.classList.toggle('rotate'); if ($tags[i].style.maxHeight && $tags[i].style.maxHeight !== maxHeight) { $tags[i].style.maxHeight = maxHeight; } else { $tags[i].style.maxHeight = $tags[i].scrollHeight + "px"; } }); })