limit characters soustitre

This commit is contained in:
2025-06-05 10:14:31 +02:00
parent 03dba84a33
commit 6be557a424
2 changed files with 15 additions and 1 deletions
File diff suppressed because one or more lines are too long
+14
View File
@@ -287,3 +287,17 @@ document.addEventListener('DOMContentLoaded', () => {
// }
// });
// ////////////////// start tronquage sous titre //////////////////
document.addEventListener("DOMContentLoaded", function () {
const maxLength = 80;
document.querySelectorAll('.view-base-de-donnees .wrapper-ressource .field--name-field-sous-titre').forEach(function (element) {
const fullText = element.textContent.trim();
if (fullText.length > maxLength) {
const truncated = fullText.slice(0, maxLength).trim() + '...';
element.textContent = truncated;
}
});
});