renderedtext / jquery.truncator.js

"more"/"less" style truncator for jQuery that handles HTML gracefully.
http://henrik.nyh.se/2008/02/jquery-html-truncate
12 stars 3 forks source link

Adjustable max length #2

Open markoa opened 13 years ago

markoa commented 13 years ago

Steve rightfully says:

BTW, I noticed that the max-length calculation using the magic number 3 is no longer accurate/relevant, but I left it unchanged because it affects the overall behaviour. It's not easy to calculate the character length of the customisable "more" link because the string might contain "→" entities or suchlike. It would therefore really be best to remove the adjustment to max-length, and instead rely on users to adjust max length according to the "more" text they have configured.

purcell commented 13 years ago

I think this is as simple as just removing the "- 3". I personally think it makes more sense for the maxLength option to correspond to the number of characters to which the original text is truncated, rather than the length of the truncated text plus that of the "more" link.

-Steve