Skip to content

Instantly share code, notes, and snippets.

@kalinchernev
Created October 23, 2014 12:13
Show Gist options
  • Save kalinchernev/86a18a1c98cff5e03246 to your computer and use it in GitHub Desktop.
Save kalinchernev/86a18a1c98cff5e03246 to your computer and use it in GitHub Desktop.
Resizor of font-size in a given div container
var zoomText = function (change) {
var fontSize, fonts, container;
container = $("#block-system-main");
fontSize = Math.floor(parseFloat(container.css('font-size')) / 16);
fonts = ["1em", "1.2em", "1.4em"];
if (change === -1 & fontSize > 0) {
fontSize--;
}
if (change === 1 & fontSize < 4) {
fontSize++;
}
container.css("font-size", fonts[fontSize]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment