Skip to content

Instantly share code, notes, and snippets.

@stefanocudini
Created March 25, 2012 12:51
Show Gist options
  • Save stefanocudini/2193433 to your computer and use it in GitHub Desktop.
Save stefanocudini/2193433 to your computer and use it in GitHub Desktop.
page font size
var min=8;
var max=18;
function increaseFontSize() {
var p = document.getElementsByTagName('p');
for(i=0;i<p.length;i++) {
if(p[i].style.fontSize) {
var s = parseInt(p[i].style.fontSize.replace("px",""));
} else {
var s = 12;
}
if(s!=max) {
s += 1;
}
p[i].style.fontSize = s+"px"
}
}
function decreaseFontSize() {
var p = document.getElementsByTagName('p');
for(i=0;i<p.length;i++) {
if(p[i].style.fontSize) {
var s = parseInt(p[i].style.fontSize.replace("px",""));
} else {
var s = 12;
}
if(s!=min) {
s -= 1;
}
p[i].style.fontSize = s+"px"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment