Read / show more / less

novější verze

.category-perex {
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}
.category-perex.noclamp {
display: -webkit-box;
-webkit-line-clamp: unset;
-webkit-box-orient: vertical;
overflow: hidden;
}

/* iOS bug fix !!! */ 

.category-perex p {
display: inline;
}

.category-perex p::after {
content: " \A\A";
white-space: pre;
}

<script>
$("<p id='show_more'>Zobrazit více »</p>").insertAfter('.category-perex');
$(document).ready(function () {
$("#show_more").on("click", function () {
$('.category-perex').toggleClass('noclamp');
$('.category-perex + p').text((i, t) => t == 'Zobrazit méně »' ? 'Zobrazit více »' : 'Zobrazit méně »');
});
});
</script>

 

-----------------------------------------

starší verze

<p id="show_more">Zobrazit více</p>
<div id="show_more_content">

// Skrytý text

</div>

 

<script>
$(document).ready(function () {
$("#show_more_content").hide();
$("#show_more").on("click", function () {
var txt = $("#show_more_content").is(':visible') ? 'Zobrazit více »' : 'Zobrazit méně »';
$("#show_more").text(txt);
$(this).next('#show_more_content').slideToggle(200);
});
});
</script>