Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS

#title not affected by fittext.js

(I've put this under CSS as this deals with a tutorial in CSS Foundations.)

http://codepen.io/AJamesL/pen/Kxugf

I've checked my code against that shown in the video, and after plugging in very small values for minFontSize and maxFontSize, I see the h1 element in question is not affected at all.

The script elements are at the bottom of the html.

2 Answers

Thanks again, James. It works great. But oddly only in CodePen; I can't get it to work offline, from my directory. Thinking it may be the browser (Chrome), I tried in Firefox--no joy. But then if I can see it work live online in Chrome it can't be the browser.

James Barnett
James Barnett
39,199 Points

Protocol-less URLs don't work without a web server, so in that case just add http: in front of the URL.

> The main caveat to keep in mind when using the protocol-less reference is that it will fail on pages loaded via file:/// (i.e. HTML pages you load directly from disk to your browser). So, do be sure to include the http: protocol in the URL if you happen to be developing without a web server at all, but don’t worry about omitting it otherwise.

source: http://encosia.com/3-reasons-why-you-should-let-google-host-jquery-for-you/

You, Sir, are a Scholar. Thank you!

James Barnett
James Barnett
39,199 Points

I'm not quite sure why but when you pasted in the fittext.js code into JavaScript section it wasn't working.

The easy solution is to just link to it directly using

<script src="//rawgithub.com/davatron5000/FitText.js/master/jquery.fittext.js"></script>