jmenglis / clamp-js-main

Clamps an HTML element by adding ellipsis to it if the content inside is too long - Originally from both xavi160 & josephschmitt
https://github.com/josephschmitt/Clamp.js/
26 stars 18 forks source link

In Firefox/IE if clamp is set to 2, it still shows an ellipsis on the 2nd line, even if the line was not clamped. #1

Closed MeltdownInteractive closed 7 years ago

MeltdownInteractive commented 7 years ago

In Chrome, the text looks correct... i.e no ellipsis on the 2nd line of text, as the text is not wrapping to a 3rd line... http://pasteboard.co/ArBHmdnam.jpg

But in IE/Firefox, even though the 2nd line is nowhere near wrapping, it still shows an ellipsis. http://pasteboard.co/3DXHJQgQp.jpg

I am using

$('.clamp').each(function (i, obj) { $clamp(obj, { clamp: 2, useNativeClamp: false, truncationChar: '...' }); });

Note : I had to set useNativeClamp to false to prevent another issue in Safari, which added a ... in the middle of the sentence.

jmenglis commented 7 years ago

I released a fix for 0.11.2 that took care of the Firefox end of line issue. At least on my test copy that is included with this repo. Let me know if you still have issues with Safari placing a ellipses in the middle of the setence.