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

Already on GitHub? Sign in to your account

Minimum font size, or minimum div width #14

Closed
davecoffin opened this Issue Dec 6, 2011 · 4 comments

Comments

Projects
None yet
3 participants

So...this plugin is awesome. And I'm psyched to bake it into a project I'm working on. But, I'm running into a problem. Let me first outline what I'm trying to do.

I have a div that will contain text that will be provided by a user, so I won't know how long it will be. So observe these examples:

example 1:
User-Provided Text: Viva La Vida

In this example (1), the text would be large if the div were like 600px. Awesome. If it shrinks down to 200px, the text will be small, but readable. Awesome.

example 2:
User-Provided Text: This Is The Name Of an Album Title, And It's Really Long, Cuz I'm A Really Indie Artist.

In this example (2), the text would be readable at 600px like this: http://cl.ly/CO5e
Awesome.
But if the container shrunk down to say, 500px, here's what it would like: http://cl.ly/CO0y
Not awesome.

So my thought process is, in options there should be something like minfontsize: BigText.DEFAULT_MIN_FONT_SIZE_PX
that say if you set to 12, the font size would shrink no further and just wrap the line at that minimum text. So whatever div width calculates a size 12 font, if the div shrinks below that the font-size is frozen at 12 and just wraps normally, or responds to text-overflow or whatever. Does that make sense?

So I'm wondering if I'm just missing an option for this or spacing on an easy workaround. Thanks for taking the time to respond!

@zachleat zachleat closed this in 0672f62 Dec 7, 2011

When the font reached minfontsize BigText is not wrapping text, I noticed its adding

.bigtext * {
white-space: nowrap;
}

to the div which contains text. Does BigText support mult-line div's? If I remove above attribute text wraps fine.

Owner

zachleat commented Sep 22, 2012

There is a bigtext-exempt class you can use to exempt a subset of the children from auto-sizing.

Thanks for your answer

If I add 'bigtext-exempt' class to div it does not auto-size at all. I want the the div to auto-size until minfontsize is reached. On minfontsize it should just wrap the text to new line instead of overflowing on the same line?

This is my jquery:

$('#MainConatiner').bigtext(
{ minfontsize: 16 }
);

Hope above makes sense

Owner

zachleat commented Nov 14, 2012

@jaminator21 please open a separate issue for this request. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment