How might I iterate over / access the properties of a referenced CSS file itself?
Hear me out, this may sound strange: I am currently wrapping the Google Maps API into some C# code (it outputs JavaScript); the Google Maps API, for things such as the Polygon class, appears to let you specify certain things like 'stroke-color' by passing in the appropriate value, but I can find no method for setting the classname for Polygon, nor immediately discover one for Polygon. So, since our HTML / CSS guy wants to skin stuff, I figured I'd use jQuery (.CSS()) or something to parse the CSS file, grab a defined property from within, and set the value in the JavaScript code.
Normally I'd set the color (for example programmatically, like so:
html.AppendLine("fillColor: '" + string.Format("#{0:X2}{1:X2}{2:X2}", fillcolor.R, fillcolor.G, fillcolor.B) + "',");
But I am trying to change it to something like this:
html.AppendLine("fillColor: $(\"Poly\").css(\"fill-color\"),");
And grab the property from a class in a referenced CSS file, defined like:
.Poly
{
stroke-color: #FF00FF;
fill-color: #FF00FF;
}
jQuery seems to want a defined element to grab CSS properties from...it does not appear to be grabbing the values directly from the CSS file (I could be wrong). The above code, unfortunately, results in 'undefined.' This may be because I am rusty with JavaScript, / CSS or it may be that the way I am attempting to access things is not correct.
Has anyone any ideas how I might accomplish my ends here?