In a GWT web application, I want to give the opportunity to my users to decrease or increase font size in the current page.
Is it possible, in GWT, to do this, if the user click on + button:
body { font-size: 150%; }
And to do this, if the user click on - button:
body { font-size: 50%; }
Thanks!
This works for a CSS inline solution. Replace CLASSNAMEHERE
to suit your needs, or pass it as a parameter of the function.
private static native void changeFontSize(int inc)/*-{
{
var p = $doc.getElementsByClassName('CLASSNAMEHERE');
for (n = 0; n < p.length; n++) {
if (p[n].style.fontSize) {
var size = parseInt(p[n].style.fontSize.replace("px", ""));
} else {
var size = 11;
}
p[n].style.fontSize = size + inc + 'px';
}
}
}-*/;