Browse Source

collapse test

master
rdrew 3 months ago
parent
commit
62579c3d96
  1. 21
      css/components/islandora_mods.css
  2. 9
      js/pwc_custom.js
  3. 1
      olivespwc.libraries.yml

21
css/components/islandora_mods.css

@ -48,3 +48,24 @@
text-decoration: underline;
font-weight: bold;
}
/*collapsable text on collections pages*/
.text-container {
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;
}
.truncated-text.full {
max-height: none; /* Show full text */
}
.more-link {
color: #007bff;
cursor: pointer;
display: inline-block;
margin-top: 5px;
}

9
js/pwc_custom.js

@ -0,0 +1,9 @@
document.querySelectorAll('.more-link').forEach(link => {
link.addEventListener('click', (e) => {
e.preventDefault();
const container = link.previousElementSibling;
container.classList.toggle('full');
link.textContent = container.classList.contains('full') ? 'Less' : 'More';
link.setAttribute('aria-expanded', container.classList.contains('full'));
});
});

1
olivespwc.libraries.yml

@ -56,6 +56,7 @@ global-styling:
js:
js/checkbox.js: {}
js/pwc_custom.js: {}
dependencies:
- core/drupal

Loading…
Cancel
Save