Web Accessibility query...

Discussion in 'Technology' started by trance_fan, Oct 4, 2007.

Users Viewing Thread (Users: 0, Guests: 0)

  1. trance_fan

    trance_fan Registered User

    Joined:
    Nov 7, 2002
    Messages:
    9,079
    Likes Received:
    0
    Web Accessibility query...

    Right, i'm trying to implement the simplest code which can allow web users to choose text size...like on sites where you have:

    A A A

    ...sort of thing.

    Now - this can be done via CSS, but it would be a bit of a fanny on and means having to maintain several style sheets.

    I've noticed that using Ctrl+Mousewheel enlarges/shrinks everything, and in proportion.

    However, using View > Text Size has absolutely no effect (does anyone know why?)

    So basically, I was wondering if there is maybe a JavaScript equivalent to the Ctrl+Mousewheel?

    Cheers!
  2. 1615634792921.png
  3. Phil Mitchell

    Phil Mitchell check me a dollar brer?

    Joined:
    May 19, 2005
    Messages:
    8,965
    Likes Received:
    1
    Location:
    Melbourne
    try this , Im sure you can work what the code does...

    var min=8;
    var max=18;
    function increaseFontSize() {
    var p = document.getElementsByTagName('p');
    for(i=0;i<p.length;i++) {
    if(p.style.fontSize) {
    var s = parseInt(p.style.fontSize.replace("px",""));
    } else {
    var s = 12;
    }
    if(s!=max) {
    s += 1;
    }
    p.style.fontSize = s+"px"
    }
    }
    function decreaseFontSize() {
    var p = document.getElementsByTagName('p');
    for(i=0;i<p.length;i++) {
    if(p.style.fontSize) {
    var s = parseInt(p.style.fontSize.replace("px",""));
    } else {
    var s = 12;
    }
    if(s!=min) {
    s -= 1;
    }
    p.style.fontSize = s+"px"
    }
    }
  4. trance_fan

    trance_fan Registered User

    Joined:
    Nov 7, 2002
    Messages:
    9,079
    Likes Received:
    0
    Good man, cheers! will try this out at some point today

Share This Page