﻿





(function($) {
    $.fn.fitText = function(options) {
        options = $.extend({
            width: 0,
            height: 0
        }, options);

        $(this).each(function() {
            var elem = $(this);
            if (options.height > 0) {
                while (elem.height() > options.height) {
                    elem.text(elem.text().substring(0, (elem.text().length - 4)) + "...");
                }
            }
            if (options.width > 0) {
                while (elem.width() > options.width) {
                    elem.text(elem.text().substring(0, (elem.text().length - 4)) + "...");
                }
            }
        });
    }
})(jQuery);
