Simple Dynamic Text size changer?

Discussion in 'Web Design and Development' started by BlakTornado, Feb 12, 2008.

  1. BlakTornado Guest


    Apr 24, 2007
    Washington, OH
    Ok, I'm basically using dashcode to make an RSS widget (Where I say make, I mean use a template and mod it :p) and would like to know a simple way of using Javascript and CSS to make a dynamic slider to control text size (or pop-up box, if worst comes to the worst).

    I'm not too familiar with javascript so all help would be appreciated.

    Basically I have a slider with this attached to it:

    function ScaleText(event)
    // Values you provide
    var rangeToChange = document.getElementById("content");	// replace with ID of range
    var contentarea = 50;								// value to change range to
    // Range code
    rangeToChange.value = 100;
    but I need a way to link that up to the CSS style "text"... if anyone knows how...

    All help appreciated.
  2. angelwatt Moderator emeritus


    Aug 16, 2005
    Here's some code that you can partly make use of,

    var currSize = 100; // initialize at 100%
    var rangeToChange = document.getElementById("content");
    // increase by 10% = (currSize * 1.1) + '%';
    Depending on how the styles are defined this should work in most browsers.

Share This Page