Skip to content

Instantly share code, notes, and snippets.

@landlessness
Created September 22, 2010 06:57
Show Gist options
  • Select an option

  • Save landlessness/591260 to your computer and use it in GitHub Desktop.

Select an option

Save landlessness/591260 to your computer and use it in GitHub Desktop.
$(document).ready(function(){
if ($('.resize-font').length) {
$(window).resize(resize);
resize();
}
});
function resize() {
// sizeCoefficient lets me decide how big the fonts are.
// 0.75 gives about 10 words per line, which is good design
var sizeCoefficient = 0.75;
var newFontSize = Math.floor(sizeCoefficient * (0.0394 * $('.resize-font').width() + 0.2489))
$('.resize-font').css('font-size', newFontSize)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment