accessibility: possible to determine browser-chosen point size of a relative font-size?

Discussion in 'Javascript' started by Timo, Jun 14, 2004.

  1. Timo

    Timo Guest

    All my font-sizes are set as relative sizes in CSS (large, medium, small,
    x-small, etc). Let's say something is set in CSS to be xx-large, but a
    visually impaired user wants it displayed even bigger. Can a script
    determine an element's absolute size, *as it is being rendered by the
    browser*, and then increment the element's font-size in absolute terms?
    Thanks!
    Timo
     
    Timo, Jun 14, 2004
    #1
    1. Advertisements

  2. Re: accessibility: possible to determine browser-chosen point sizeof a relative font-size?

    Well, I have this script that makes a line span the screen size. You can
    ofcourse always do something like document.body.style.fontSize='5cm';
    This would make characters about 5 centimeters high.

    <html>
    <head>
    <script language="JavaScript">
    <!--

    function calibrate() {
    obj = document.getElementById('sizetest');
    grow(0, obj.offsetHeight);
    }


    function grow(size, rowHeight) {
    size+=10;
    document.body.style.fontSize = size+'px';
    window.setTimeout(
    "growTest("+size+","+rowHeight+");",10);
    }

    function shrink(size, rowHeight) {
    size-=1;
    document.body.style.fontSize = size+'px';
    window.setTimeout(
    "shrinkTest("+size+","+rowHeight+");",10);
    }

    function shrinkTest(size, rowHeight) {
    obj = document.getElementById('sizetest');
    if (obj.offsetHeight>(rowHeight/2)) {
    shrink(size, obj.offsetHeight);
    }
    }

    function growTest(size, rowHeight) {
    obj = document.getElementById('sizetest');
    if (obj.offsetHeight>(rowHeight*2)) {
    shrink(size, obj.offsetHeight);
    } else {
    grow(size, obj.offsetHeight);
    }
    }


    <!-- -->
    </script>

    </head>


    <body onLoad="calibrate();">

    <SPAN id="sizetest">This should span a whole line</SPAN>

    </body>
    </html>


    Timo wrote:
    > All my font-sizes are set as relative sizes in CSS (large, medium, small,
    > x-small, etc). Let's say something is set in CSS to be xx-large, but a
    > visually impaired user wants it displayed even bigger. Can a script
    > determine an element's absolute size, *as it is being rendered by the
    > browser*, and then increment the element's font-size in absolute terms?
    > Thanks!
    > Timo
    >
    >
    >
    >
     
    Vincent van Beveren, Jun 14, 2004
    #2
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andreas Klemt
    Replies:
    6
    Views:
    16,336
    Peter Theill
    Nov 28, 2004
  2. dave richards
    Replies:
    2
    Views:
    866
    Paul Furman
    Feb 19, 2004
  3. bob
    Replies:
    4
    Views:
    10,526
    nice.guy.nige
    Jun 18, 2004
  4. =?Utf-8?B?Q2hyaXM=?=

    Determine Client Browser Window Size

    =?Utf-8?B?Q2hyaXM=?=, Jul 15, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    5,187
    Ken Cox [Microsoft MVP]
    Jul 15, 2006
  5. wial
    Replies:
    2
    Views:
    1,065
  6. mttc
    Replies:
    2
    Views:
    2,712
    Roedy Green
    Jul 3, 2009
  7. Saraswati lakki
    Replies:
    0
    Views:
    1,699
    Saraswati lakki
    Jan 6, 2012
  8. Replies:
    1
    Views:
    250
    marss
    Feb 6, 2007
Loading...