Skip to content

Instantly share code, notes, and snippets.

View ADParris's full-sized avatar
🎯
Focusing

Andrew Parris ADParris

🎯
Focusing
View GitHub Profile
@ADParris
ADParris / jquery.textfill.js
Created December 2, 2012 07:33 — forked from juliankrispel/jquery.textfill.js
jQuery Plugin to resize text to fit container
(function($) {
$.fn.textfill = function(maxFontSize) {
maxFontSize = parseInt(maxFontSize, 10);
return this.each(function(){
var ourText = $("span", this);
function resizefont(){
var parent = ourText.parent(),
maxWidth = parent.width(),
fontSize = parseInt(ourText.css("fontSize"), 10),
multiplier = maxWidth/ourText.width(),