cyberspace
Technical User
I am wanting to allow users to resize text on a website I am developing via clicking an option in the menu to increase/decrease text size.
I tried this code:
But, this only increases static text, and has no effect on text coming from the database, such as the newsfeed.
However, if I hold ctrl and roll the mouse wheel in either direction, everything is increased/decreased proportionately.
I was wondering if there is a JS equivalent to this? (or indeed any other type of equivalent that could be tied to a link/button)
Thanks
'When all else fails.......read the manual'
I tried this code:
Code:
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"
}
}
But, this only increases static text, and has no effect on text coming from the database, such as the newsfeed.
However, if I hold ctrl and roll the mouse wheel in either direction, everything is increased/decreased proportionately.
I was wondering if there is a JS equivalent to this? (or indeed any other type of equivalent that could be tied to a link/button)
Thanks

'When all else fails.......read the manual'