-
-
Notifications
You must be signed in to change notification settings - Fork 210
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
Fit to container height #9
Comments
Thanks! I want to keep the library as small as possible, but this seems like a logical feature for it, I'll see if I can incorporate it without it adding too much additional weight. |
@RosIvanov Thanks! Will test that out once I get a chance. |
@RosIvanov Thanks! |
@gragland @rikschennink You are welcome) Please note that this is very tiny code snippet which does not detect @font-face load and images load. |
@gragland Hey so does this js plugin detect height now, or does that gist linked work? I've been using textSlab.js and it works well for breaking stuff up into multiple lines but if the text being broken up is super long then it makes stuff waaaay to tall. |
@thedonquixotic linked gist has to work if you set |
@RosIvanov Does it work with max-height? |
@thedonquixotic guess it should |
It's been a year since this issue was opened. |
@deviousasti The plans are there, it's the time that is the problem, can't believe it's already been a year. |
I just wrote my own:
HTML
Usage
|
Nice! Thanks for posting. |
Why not do a pull request to add these changes in to the original plugin? I'm just a designer learning to code so I get that my JS is super rusty and maybe I'm not understanding the conversation but that seems like a good idea right? If there's a limitation to the plugin, and a fix has been posted then shouldn't that change be pulled in? |
@RosIvanov thanks for adding that resize code. Unfortunately it doesn't work for me. |
@impactcolor sorry for late reply, hope you already have solved this problem. |
Any updates on this? This is what I'm also missing right now :) |
I had a problem where , since it only uses width, the lib made the text too tall for the container. You can mod the following line where maxSize is the height of the parentNode : for my project, jQuery was already injected so I used
|
any news? |
@GuilhermeCouto apart from solutions posted by other devs, no |
same issue..please support this feature |
nice |
The gist link above does not come up now. Can some one please paste the code snippet here if it works for height? The other piece of code does not set max and min fonts. How to make the resize working with height as well? |
I am currently in need of this and am willing to contribute a PR if someone can point me in the right direction. |
@madmod I'm open to merging it, but only if it's fast and doesn't add too much weight. |
Please have a look at the bold lines which I added to make it work: l = function (e) { |
Thanks, this looks like a super small change, I'll take a look at this sometime in the next couple weeks. |
@LeelaBasavaiah can you create a public demo of this code on https://codesandbox.io |
I would love to see support to make text respect the height of the container in fitty.js, that would make it the best text fitting solution I have seen yet 👍 |
Arrived here in search of a way to get height fitting working. Would also love to see it. |
I read the entire thread, so i found a solution that would solve my problem of resizing the text; when the text overflows the container height using this library : use-fit-text 👍 : https://www.npmjs.com/package/use-fit-text, https://github.com/saltycrane/use-fit-text/blob/master/index.ts |
Awesome work on this library! I'm looking for something similar but that scales the font size of multi-line text to always fit the container height rather than width. Any thoughts on adding a height option?
The text was updated successfully, but these errors were encountered: