Как развернуть усеченный текст по клику с помощью dotdotdot?
Я используюjQuery dotdotdot
плагин усеченияdotdotdot.frebsite.nl
Я хочу обрезать до 2 строк. И когда пользователь нажимает наmore
, тогда он должен показать полный текст (развернуть / де-усечь).
Пока ятолько" удалось усечь мой текст. Но не "де-усеченный» Это.
Вот мой код:
<p class="truncate">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut vitae tellus eu dui placerat interdum. Lorem ipsum dolor sit amet, consectetur adipiscing elit.<a class="read-more" href="#">more</a></p>
$(document).ready(function(){
$('.truncate').dotdotdot({
ellipsis : '… ',
watch : true,
wrap : 'letter',
height : parseInt( $('.truncate').css('line-height'), 10) * 2, // this is the number of lines
lastCharacter: {
remove: [ ' ', ',', ';', '.', '!', '?' ],
noEllipsis: []
},
after: "a.read-more"
});
});
Live демоjsfiddle.net/NSnxe/1