min-height bug
Riant opened this issue · 0 comments
Riant commented
Thanks for your great work, But when I set a min-height for the element to make the less-text box same height as the trunk8 box, trunk8 will get the min-height as line_height, there are some suggestions to fix that, wish it help you:
Change the line 342:
$(elem).html('i').wrap('<div id="' + wrapper_id + '" />');
/* Calculate the line height by measuring the wrapper.*/
line_height = $('#' + wrapper_id).innerHeight();
/* Remove the wrapper and reset the content. */
$(elem).html(html).css({ 'float': floats, 'position': pos }).unwrap();
To:
$(elem).html('<div id="' + wrapper_id + '">i</div>');
/* Calculate the line height by measuring the wrapper.*/
line_height = $('#' + wrapper_id).innerHeight();
/* Remove the wrapper and reset the content. */
$(elem).html(html).css({ 'float': floats, 'position': pos });
And this will let we get the right line-height even when the box has padding-top/bottom.
But to make it works better, that change looks not enough, maybe we need to check the height in a temporary div-box when we cut the text one by one. So is that better to change from line 185 (I haven't test the code below.)
this.html(bite);
/* Check for overflow. */
if (this.height() > line_height) {
upper = bite_size - 1;
}
TO
this.html('<div>'+ bite + '</div>');
/* Check for overflow. */
if (this.children('div').height() > line_height) {
upper = bite_size - 1;
}
What's your opinion?