I’m using the jQuery dotdotdot 1.6.12 plugin to add an ellipsis to truncated text. You can see it on this page by clicking any of the ‘EN SAVOIR PLUS’ buttons under ‘COMPÉTENCES’ http://debourg-dev.ch/crea/
I use the below code to add the ellipsis:
$(“.truncate-text”).dotdotdot();
$(".truncate-wrap article").click(function(event) {
event.preventDefault();
if ($(this).hasClass("truncated")) {
$(this).removeClass("truncated");
$(this).find(".truncate-text").trigger("destroy");
$(this).find(".truncate-text").css({'height': 'auto', 'margin-bottom': '0'});
$(this).find(".truncate").hide();
} else {
$(this).addClass("truncated");
$(this).find(".truncate-text").css({'height': '80px', 'margin-bottom': '20px'});
$(this).find(".truncate-text").dotdotdot();
$(this).find(".truncate").show();
}
});
How can I animate the transition to slide up/down (like a jquery toggle for example) when the full text is shown/truncated?
Thanks