Estaba tratando de agregarle a Joomla un componente para agrandar y achicar el tamaño de letra. Si bien hay varios, ninguno funcionaba correctamente. Encontré entonces un script que funciona super bien, y que funciona para cuando tenemos los tamaños de letra en px (que es lo que uso habitualmente).
El script es el siguiente:
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" } } Y se usa, así: <a href="javascript:decreaseFontSize();">-</a> <a href="javascript:increaseFontSize();">+</a> (Tomado de: http://www.white-hat-web-design.co.uk/blog/controlling-font-size-with-javascript/)
Deja una respuesta