Skip to content

Instantly share code, notes, and snippets.

@newswim
Created June 12, 2015 23:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save newswim/b41774382697c83ba35e to your computer and use it in GitHub Desktop.
Save newswim/b41774382697c83ba35e to your computer and use it in GitHub Desktop.
$(document).ready(function () {
resize_to_fit();
});
function resize_to_fit(){
var fontsize = $('div#outer div').css('font-size');
$('div#outer div').css('fontSize', parseFloat(fontsize) - 1);
if($('div#outer div').height() >= $('div#outer').height()){
resize_to_fit();
}
}
// CSS-Tricks
$(function(){
var $quote = $("#floor-plan-title");
var $numWords = $quote.html/*()*/.length;
if (($numWords >= 1) && ($numWords < 10)) {
$quote.css("font-size", "36px");
}
else if (($numWords >= 10) && ($numWords < 20)) {
$quote.css("font-size", "32px");
}
else if (($numWords >= 20) && ($numWords < 30)) {
$quote.css("font-size", "28px");
}
else if (($numWords >= 30) && ($numWords < 40)) {
$quote.css("font-size", "24px");
}
else {
$quote.css("font-size", "20px");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment