Closed gregthrive closed 10 years ago
Can you put it in a codepen?
Codepen demo didn't work.
Your .btn
needs to be display:block
or inline-block
with a width. We can't really do width based resizing on (inline) elements that don't have width http://jsfiddle.net/yvkk11rq/3/
Adding block gets it to resize, but ruins the styling. Inline-block keeps the styling correct, but then FitText still doesn't work. The container it's contained in (in my actual code) does have a width.
Not sure why closed... still doesn't work.
Maybe width is too small to get max font size? If so, my bad.
Eh, I keep correct font size of a P tag and look at it's bounding box size which is 600px. So I can know that with 600px width it can display full size. I set maxfont to be that desired full size and on load it shrinks text. Container has a width as does the p tag.
@gregthrive you've applied two fixed widths to the elements. That means header
and a.btn
don't technically resize. Setting the a.btn
to a inline-block with a fluid width seems to accomplish a desired effect.
http://jsfiddle.net/yvkk11rq/8/
It's possible you're trying to achieve a visual effect that doesn't work with FitText at all. The plugin seems to be working as intended on this end and I'd recommend playing with it some more.
Thanks for your assistance I will keep playing with it!
I have a very simple set up with an link that has a default font size of 46px (calculated from REM).
jQuery("a.btn").fitText( 2.0, <-- irrellevant { minFontSize: '22px', maxFontSize: '46px' })
No matter what size the screen is at, it always loads 22px in font size.