diff --git a/css/components/islandora_mods.css b/css/components/islandora_mods.css index 5efc0b5..870ed0c 100755 --- a/css/components/islandora_mods.css +++ b/css/components/islandora_mods.css @@ -50,22 +50,22 @@ } /*collapsable text on collections pages*/ .text-container { - max-width: 600px; /* Adjust as needed */ + max-width: 600px; /* Adjust as needed */ } .truncated-text { - max-height: 2.1em; /* Initial truncation height (~3 lines) */ - overflow: hidden; - transition: max-height 0.3s ease; + max-height: 3em; /* Initial truncation height (~3 lines) */ + overflow: hidden; + transition: max-height 0.3s ease; } .truncated-text.full { - max-height: none; /* Show full text */ + max-height: none; /* Show full text */ } .more-link { - color: #007bff; - cursor: pointer; - display: inline-block; - margin-top: 5px; + color: #007bff; + cursor: pointer; + display: inline-block; + margin-top: 5px; } diff --git a/js/pwc_custom.js b/js/pwc_custom.js index 8fd22b0..3fcf71e 100644 --- a/js/pwc_custom.js +++ b/js/pwc_custom.js @@ -1,7 +1,8 @@ document.querySelectorAll('.more-link').forEach(link => { link.addEventListener('click', (e) => { e.preventDefault(); - const container = link.previousElementSibling; + // Find the parent text-container and then the truncated-text div + const container = link.closest('.text-container').querySelector('.truncated-text'); container.classList.toggle('full'); link.textContent = container.classList.contains('full') ? 'Less' : 'More'; link.setAttribute('aria-expanded', container.classList.contains('full'));