rviscomi / trunk8

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

Truncate labels #69

Closed ULKARAMAKRISHNAN closed 8 years ago

ULKARAMAKRISHNAN commented 8 years ago

Hi,

I am trying to truncate text inside labels. But its clearing off all the texts instead of just truncating.

Any help would be great.

Thanks

rviscomi commented 8 years ago

Could you make a js fiddle demonstrating your issue?

ULKARAMAKRISHNAN commented 8 years ago

https://jsfiddle.net/nuggm16d/ You can have a look at the issue in the above fiddle.

I figured out the prob here and fixed it. The line height of 9px was causing the issue. But not sure why was it causing the prob.

Curious to know the reason behind it.

Thanks

rviscomi commented 8 years ago

The issue is that you are forcing the line height of the LI element to 9px. At the same time, you're using DIVs for both the radio button and the truncated label. DIVs are block-level by default, so they each take up their own line. By forcing the line-height to 9px, you're cutting off the second DIV containing the label. So the text is being truncated properly but you're hiding it by masking the contents of the LI.

ULKARAMAKRISHNAN commented 8 years ago

Even I thought of it but then when I inspect I dont see the text being truncated. It is totally blank.

rviscomi commented 8 years ago

Just make the line-height fit the text (16px).

ULKARAMAKRISHNAN commented 8 years ago

Thanks. It works.