346
Programming / Fontsize changing (js) by id (html tag) will not work proper help needed
« on: October 20, 2010, 04:31:41 AM »
Hi,
i have this js (put in root/js/fontsize.js):
in header.html:
in any template.html:
I've set the id to change the fontsize to "container" this is my main div for the hole galery...
But only some custom text in the footer changes his fontsize... (not the copyright text)
I thought the main div inherits to sub divs?
If not how to handle this with the js? is there an easy way without set an individual id to any tag
i like to change the fontsize?
Greetz X23
i have this js (put in root/js/fontsize.js):
Code: [Select]
//<!-- Textgroesse anfang -->
var faktor = 0.05;
var start_groesse = 1.0;
var anz = 0;
function fontsizer(inc, reset) {
if ((anz + inc >= 0) && (anz + inc <= 2)) {
anz += inc;
neue_groesse = anz * faktor + start_groesse;
artikel_text = document.getElementById('container');
artikel_text.style.fontSize = neue_groesse + "em";
}
switch (anz) {
case 0:
document.getElementById("fsminus").src = "templates/Iceberg/images/fontsize_down_inactive.png";
break;
case 2:
document.getElementById("fsplus").src = "templates/Iceberg/images/fontsize_up_inactive.png";
break;
default:
document.getElementById("fsplus").src = "templates/Iceberg/images/fontsize_up.png";
document.getElementById("fsminus").src = "templates/Iceberg/images/fontsize_down.png";
break;
}
}
//<!-- Textgroesse ende -->
in header.html:
Code: [Select]
<script language="javascript" src="./js/fontsize.js"></script>
in any template.html:
Code: [Select]
<a href="javascript:void(0)" onmousedown="fontsizer(-1, false)" onfocus="blur()"><img src="{template_url}/images/fontsize_down.png" id="fsminus" border="0"></a>
<img src="{template_url}/images/fontsize_font.png" id="fsminus" border="0"></a>
<a href="javascript:void(0)" onmousedown="fontsizer(1, false)" onfocus="blur()"><img src="{template_url}/images/fontsize_up.png" id="fsplus" border="0"></a>
I've set the id to change the fontsize to "container" this is my main div for the hole galery...
But only some custom text in the footer changes his fontsize... (not the copyright text)
I thought the main div inherits to sub divs?
If not how to handle this with the js? is there an easy way without set an individual id to any tag
i like to change the fontsize?
Greetz X23