Programming

Set a Minimum Font Size

This is just a little script I needed to use to increase text size conditionally. It only increases text below a minimum size and leaves everything else.

(function () {
    var minFontSize = function () {
        $(".content-zone *").each(function () {
            var $this = $(this);
            if (parseInt($this.css("fontSize"), 10) < 16) {
                $this.css({ "font-size": "16px" });
            }
        });
    };

    $(document).ready(minFontSize);
    $(document).ajaxComplete(minFontSize);
})();

Before Image

Text Size Before

After Image

Text Size After

You can see that the span element is the same size before and after, but all the tiny text has been increased to the minimum size.