473,507 Members | 13,597 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I see the "Smaller Font" menu command?

In Javascript, how do I detect that the user has used the browser's menu
command to make the font smaller?

I just need some kind of event or callback, so I can adapt to the new
environment.

--
David Phillip Oster
Jul 23 '05 #1
3 1335
In article <os*************************@newssvr13-ext.news.prodigy.com>,
os***@ieee.org enlightened us with...
In Javascript, how do I detect that the user has used the browser's menu
command to make the font smaller?


I don't think you can tell that.

Especially since a user can resize text by using the mouse, too. Mine is set
up to resize when I use control + middle mouse scroll.

--
--
~kaeli~
The best part of having kids is giving them back to their
parents.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2
Ivo
"kaeli" wrote
os***@ieee.org enlightened us with...
In Javascript, how do I detect that the user has used the browser's menu
command to make the font smaller?


I don't think you can tell that.

Especially since a user can resize text by using the mouse, too. Mine is
set up to resize when I use control + middle mouse scroll.


All the known events do not cover this, which is a shame indeed, so you need
to constantly monitor the dimensions of a test element. A quick and dirty
example uses the setTimeout() method for that:

<script type="text/javascript">

var old, tid;

function checksize() {
var cur = document.getElementById('test').offsetWidth;
if( old && old !== cur ) {
alert( 'You just zoomed ' + ( old < cur ? 'in' : 'out' ) + '!' );
}
old = cur;
tid = setTimeout( ' checksize(); ', 50 );
}

window.onload = checksize;

</script>
</head><body>
<div id="test" style="position:absolute;left:-100px;">WWW</div>

In a quick test I learned if the page is in a frameset, IE does not update
offsetWidth's etc. until the window is resized, sigh.
hth
--
Ivo


Jul 23 '05 #3
In article <42***********************@news.wanadoo.nl>,
"Ivo" <no@thank.you> wrote:
All the known events do not cover this, which is a shame indeed, so you need
to constantly monitor the dimensions of a test element. A quick and dirty
example uses the setTimeout() method for that:

<script type="text/javascript">

var old, tid;

function checksize() {
var cur = document.getElementById('test').offsetWidth;
if( old && old !== cur ) {
alert( 'You just zoomed ' + ( old < cur ? 'in' : 'out' ) + '!' );
}
old = cur;
tid = setTimeout( ' checksize(); ', 50 );
}

window.onload = checksize;

</script>
</head><body>
<div id="test" style="position:absolute;left:-100px;">WWW</div>

In a quick test I learned if the page is in a frameset, IE does not update
offsetWidth's etc. until the window is resized, sigh.


Thank you. Not great, but it will do.

David Phillip Oster

--
David Phillip Oster
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
3071
by: Andreas Prilop | last post by:
Internet Explorer displays <tt>, <code> etc. in a smaller font size: http://www.unics.uni-hannover.de/nhtcapri/temp/monospace.html I don't like the idea that monospaced text is displayed in a...
6
13075
by: Matt Adams | last post by:
I want define for a couple of words inside a longer text with different font specifications. I declared it like: ....text before.... <FONT class=aaa> these text should get other attributes...
2
1772
by: David Trimboli | last post by:
If you look at http://www.trimboli.name/klingon/, you'll see that the headers on the page are displayed in small-caps. Usually, this is desired. However, the header "may'vaD ghuHmoH QoQ"* is...
0
1191
by: Chad Sanford | last post by:
I have some server side code that instantiates a font object that is then used for generating a chart. It has worked great on many machines, but I have run into one where it is throwing a...
1
1866
by: Achim Domma (SyynX Solutions GmbH) | last post by:
Hi, is there a possibility to set the font size to a percent value of the "top level" font size? For example: The font size of the body might be 100% and I have a div which should have a...
0
1260
by: Altemir | last post by:
I have a datagrid in an .aspx page that contains some columns using the "Font=Bold" inline style. The problem is that some users' browsers aren't displaying the bold font while others are. We...
4
5566
by: Iacopo.Marmo | last post by:
Hi! I need to manipulate multicolor strings, i.e. strings with a color associated with each letter. Any suggestions?
9
4511
by: MadingS | last post by:
Is there an HTML (or CSS) way to say "use the user's INPUT font, whatever that might be."? Most browsers have the ability for the user to pick his or her own preference for what font to use...
4
10803
by: david.karr | last post by:
I'm a CSS newbie, but I was browsing through the css files in the YUI library, and I noticed the following line: body {font:13px/1.231 arial,helvetica,clean,sans-serif;*font-...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7110
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7314
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7030
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.