Skip to content

Instantly share code, notes, and snippets.

View sujeshkumaruv's full-sized avatar

Sujesh Kumar U V sujeshkumaruv

View GitHub Profile
(function($) {
$.fn.textfill = function(maxFontSize) {
maxFontSize = parseInt(maxFontSize, 10);
return this.each(function(){
var ourText = $("span", this),
parent = ourText.parent(),
maxHeight = parent.height(),
maxWidth = parent.width(),
fontSize = parseInt(ourText.css("fontSize"), 10),
multiplier = maxWidth/ourText.width(),