Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

BlakTornado

Guest
Original poster
Apr 24, 2007
944
0
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:

HTML:
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.
 
Here's some code that you can partly make use of,

Code:
var currSize = 100; // initialize at 100%
var rangeToChange = document.getElementById("content");
// increase by 10%
rangeToChange.style.fontSize = (currSize * 1.1) + '%';

Depending on how the styles are defined this should work in most browsers.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.