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

"font-size: 0px", found a wierd font-size bug. #155

Closed
RobinBertilsson opened this issue May 20, 2016 · 3 comments
Closed

"font-size: 0px", found a wierd font-size bug. #155

RobinBertilsson opened this issue May 20, 2016 · 3 comments
Labels

Comments

@RobinBertilsson
Copy link

RobinBertilsson commented May 20, 2016

Sometimes you'll get "font-size: 0px", this is my solution..

  1. Break out the value
    var value = Math.max(Math.min($this.width() / (compressor * 10), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize));
  2. Basicly check if the font-size is 0
    if (value !== 0) { $this.css('font-size', value); }

Works fine for me.
/R

@davatron5000
Copy link
Owner

@RobinBertilsson I realize you posted this quite awhile ago. But could you post a CodePen or something that demonstrates the problem? Or are you just saying it'd be good to never set the font-size to 0 ever?

@RobinBertilsson
Copy link
Author

Hey sorry, missed that you replied, cant rly figure out what caused it atm. But i'd say skip font-size: 0, why would you "fittext" a text with fontsize 0 :)

@Memocana
Copy link

I'm currently having a similar issue where its calculating 0 for font-size because its currently within a hidden div in my view. Haven't found a way around it but just wanted to share one case the same event occurs.

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

No branches or pull requests

3 participants