document.body.style.zoom

J

jnag

I am trying to implement font changer, where I have links on the
banner of the site and when the user clicks on the links, the font
size of the page has to change. I tried
document.body.style.fontSize='50%' for example, on an onclick() event,
but it did not work.

I tried zooming with the following code, and it works:

<td valign="baseline"><a href="#" onclick="(document.body.style.zoom)?
document.body.style.zoom/=1.2:document.body.style.zoom=1/1.2">A-
&nbsp;</a></td>

<td valign="baseline"><a href="#"
onclick="document.body.style.zoom=1">A&nbsp;</a></td>

<td valign="baseline"><a href="#" onclick="(document.body.style.zoom)?
document.body.style.zoom*=1.2:document.body.style.zoom=1.2">A+</a></
td>

But, I have a question. This is zooming the text on the page we are
on. But, when we go to another page on the site, this is not carried
forward (the zoom factor). Is there a way to do that?

Also, is there a way to not zoom the left and top navigation bars, but
just zoom the content page?

Thanks in advance for any suggestions,
jnag
 
P

Peter Michaux

I am trying to implement font changer, where I have links on the
banner of the site and when the user clicks on the links, the font
size of the page has to change. I tried
document.body.style.fontSize='50%' for example, on an onclick() event,
but it did not work.

Why didn't that work? It should. Is the font size in you CSS cascade
blocking this from working?

Peter
 
J

jnag

Why didn't that work? It should. Is the font size in you CSS cascade
blocking this from working?

Peter

Yes, I think the font size in the CSS is preventing this from working.
But, I am not sure how to fix it.
Thanks.
 
P

Peter Michaux

Yes, I think the font size in the CSS is preventing this from working.
But, I am not sure how to fix it.

If it is a CSS cascade issue then look into CSS cascade rules and how
the CSS selectors vary in priority. I think that would be the safest
thing to do. Trying to fix this with JavaScript is hacking for sure.
If you use the Firefox Firebug plugin you can easily see which rules
are being blocked by other rules in the cascade.

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,160
Messages
2,570,889
Members
47,423
Latest member
henerygril

Latest Threads

Top