Majster87 Posted May 17, 2025 Posted May 17, 2025 Próbuje zwinac tekst w opisie i edytowałem orginalny fragment na cos takiego <div class='ipsType_richText ipsContained ipsType_break ipsSpacer_bottom' data-controller='core.front.core.lightboxedImages core.front.core.truncate' data-truncate-size='5' data-truncate-type='lines' data-truncate-more='[Rozwiń]' data-truncate-less='[Zwiń]'> {$file->content()|raw} </div> {{if $file->editLine()}} {$file->editLine()|raw} {{endif}} ale nie zwija tekstu 😕 Zostaw suba, dużo pomożesz w tworzeniu: https://www.youtube.com/channel/UC8T8FoCAhg64dNIxQfCwhEQ
Solution Majster87 Posted May 17, 2025 Author Solution Posted May 17, 2025 (edited) ok poradziłem sobie, uzyskałem to tym kodem: <div id="descContainer"> <div id="descContent"> {$file->content()|raw} </div> <a href="#" id="toggleBtn" style="display:inline-block; margin-top:10px; font-weight:bold;">[Rozwiń]</a> </div> {{if $file->editLine()}} {$file->editLine()|raw} {{endif}} <script> document.addEventListener("DOMContentLoaded", function () { const content = document.getElementById("descContent"); const toggleBtn = document.getElementById("toggleBtn"); const maxLines = 5; const lineHeight = 24; const fullHeight = content.scrollHeight; const maxHeight = maxLines * lineHeight; if (fullHeight <= maxHeight) { toggleBtn.style.display = "none"; return; } content.style.maxHeight = maxHeight + "px"; content.style.overflow = "hidden"; let expanded = false; toggleBtn.addEventListener("click", function (e) { e.preventDefault(); expanded = !expanded; content.style.maxHeight = expanded ? fullHeight + "px" : maxHeight + "px"; toggleBtn.textContent = expanded ? "[Zwiń]" : "[Rozwiń]"; }); }); </script> Edited May 17, 2025 by Majster87 Zostaw suba, dużo pomożesz w tworzeniu: https://www.youtube.com/channel/UC8T8FoCAhg64dNIxQfCwhEQ
Manager DawPi Posted May 17, 2025 Manager Posted May 17, 2025 3 godziny temu, Majster87 napisał(a): <div class='ipsType_richText ipsContained ipsType_break ipsSpacer_bottom' data-controller='core.front.core.lightboxedImages core.front.core.truncate' data-truncate-size='5' data-truncate-type='lines' data-truncate-more='[Rozwiń]' data-truncate-less='[Zwiń]'> {$file->content()|raw} </div> {{if $file->editLine()}} {$file->editLine()|raw} {{endif}} Jak się to pokazywało? intermedia - profesjonalne rozwiązania Invision Power Board --- Chcesz uzyskać szybko i sprawnie pomoc? Uzupełnij wersję i adres w profilu.
Majster87 Posted May 17, 2025 Author Posted May 17, 2025 27 minut temu, DawPi napisał(a): Jak się to pokazywało? Bez zmian, nie zwijało tekstu w ogóle. Zostaw suba, dużo pomożesz w tworzeniu: https://www.youtube.com/channel/UC8T8FoCAhg64dNIxQfCwhEQ
Manager DawPi Posted May 18, 2025 Manager Posted May 18, 2025 Problem ROZWIĄZANY. Jeśli są jakiekolwiek wątpliwości, pytania proszę o założenie nowego tematu. Wszelkie uzasadnione reklamacje/pretensje/sugestie/rady przyjmuje ekipa forum. intermedia - profesjonalne rozwiązania Invision Power Board --- Chcesz uzyskać szybko i sprawnie pomoc? Uzupełnij wersję i adres w profilu.
Recommended Posts