Skip to content

Instantly share code, notes, and snippets.

View jjxtra's full-sized avatar

Jeff Johnson jjxtra

View GitHub Profile
@jjxtra
jjxtra / truncate_multiline_text_jquery.js
Last active March 7, 2024 18:30
Truncate multiline text in jquery without needing to pay for stupid licenses.
function truncateTextWithEllipsis(selector, text, maxHeight)
{
var el = $(selector);
el.text(text);
if (el.height() > maxHeight)
{
//console.log('Start shrink ' + text);
while (el.height() > maxHeight && text.length > 0)
{