rviscomi / trunk8

jQuery Truncation Plugin -- THIS PROJECT IS NO LONGER MAINTAINED
MIT License
703 stars 95 forks source link

Trunk8 cutting text to late #38

Open simonferndriger opened 10 years ago

simonferndriger commented 10 years ago

Example: http://www.lookr.com/de/lookout/1357752542-S%C3%B6renberg

Below "Marbach LU", the description is empty, because the text is NOT cut, therefore it is too long and gets hidden because of the css "overflow:hidden".

SAME results when using an additional "span" element for the target text.

image

rviscomi commented 10 years ago

Can you double check the timing of your $.trunk8() calls, to make sure that this isn't an issue of trunk8ing text in one font, then substituting it with a bigger web font?

simonferndriger commented 10 years ago

OK, sure. Please tell me again how I can check properly?

rviscomi commented 10 years ago

Put a breakpoint in your code when you trunk8 and check the font of the text. I looked at your source and couldn't find where you call trunk8().

simonferndriger commented 10 years ago

OK, trunk8() gets called 2 times. First on document.ready (where the new font seems not to be loaded fully yet), then again on window.load. See attachment.

Does this mean, that I only are allowed to call trink8 once on window.load here?

First call (document.ready): first_call

Second call (window.load): second_call

simonferndriger commented 10 years ago

I now tried an alternative version in which I execute trunk8 only ONCE and AFTER the font is fully loaded. SAME result.

onwindowload

rviscomi commented 10 years ago

The other thing that could be affecting it is the "11km" part. When is that text set? Is it possible that the text is truncated to the full line then the km is inserted?

simonferndriger commented 10 years ago

OK, good idea. But no. The text is generated directly via PHP and is there from the very beginning. Sorry. Any other options?

rviscomi commented 10 years ago

Sorry I can't think of anything else. For filing bugs against trunk8 you should show what part of the trunk8 code is broken. So I would suggest stepping through the code to find out why it isn't working as expected, and if you find it you can either report it here in this issue or file a pull request.