I am using jquery.dotdotdot to truncate lengthy text on the Tiles on the Carousel. Truncation sometimes is intermittently truncating less than the expected result. (e.g. truncate a text to 4 lines but at some point it only truncates to 3 lines.)
On my CSS the formula I used to have 4 lines is Max-height = line-height * 4.
Appreciate any response. Thanks. JS:
$(document).ready(function () {
EllipsisConfigFunction($(".module-body.dot-ellipsis"));
function EllipsisConfigFunction($elements) {
$elements.each(function () {
var $element = $(this);
$element.dotdotdot({
// configuration goes here
ellipsis: '... ',
/* How to cut off the text/html: 'word'/'letter'/'children' */
wrap: 'word',
/* Wrap-option fallback to 'letter' for long words */
fallbackToLetter: true,
/* jQuery-selector for the element to keep and put after the ellipsis. */
after: null,
/* Whether to update the ellipsis: true/'window' */
watch: true,
/* Optionally set a max-height, can be a number or function.
If null, the height will be measured. */
height: null,
/* Deviation for the height-option. */
tolerance: 0,
/* Callback function that is fired after the ellipsis is added,
receives two parameters: isTruncated(boolean), orgContent(string). */
callback: function (isTruncated, orgContent) { },
lastCharacter: {
/* Remove these characters from the end of the truncated text. */
remove: [' ', ',', ';', '.', '!', '?'],
/* Don't add an ellipsis if this array contains
the last character of the truncated text. */
noEllipsis: []
}
});
});
}
});
CSS:
.module-body{
max-height: 80px;
overflow: hidden;
position: relative;
text-align: left;
line-height:20px;
}