Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

min-height bug #48

Open
Riant opened this issue Jul 21, 2014 · 0 comments
Open

min-height bug #48

Riant opened this issue Jul 21, 2014 · 0 comments

Comments

@Riant
Copy link

Riant commented Jul 21, 2014

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant