Yes, all I want is to get a color for a specific class in the CSS.
Basically is this:
I have a class for the links when they are a:link, a:visted and
a:active which has color A, then, I have a different class for a:hover
which has color B. This way, the links will have different colors when
the mouse are hover them right? I just need to get those 2 colors so I
can animate the color transition when the mouse moves hover the link.
Otherwise, I would need to define the hover color in the javascript,
but this way wouldn't allow me to swap the color easily cy just
changing it in the CSS. I think you get the picture now, and
document.styleSheets seems the best option.

jQuery doesn't support this object, I have to use it directly correct?

On Aug 7, 10:43 pm, "Dan G. Switzer, II" <[EMAIL PROTECTED]>
wrote:
> >You are right, I created the element in the DOM and it worked fine.
> >However I found this:
> >http://www.javascriptkit.com/dhtmltutors/externalcss.shtml
> >And it seems it's exactly what I was looking for in the first place,
> >but I don't if I should use it as some browsers (though they are less
> >used) do not support the styleSheets object and creating the element
> >in the DOM and then remove it, probably works on most of them, I just
> >don't like the solution cause it feels like a "work around" and what I
> >really want, I can do it with document.styleSheets.
>
> I was going to suggest that, but then you get in to some specifity issues
> with CSS (since an element can have multiple classes assigned even specific
> styles applied to it.)
>
> If all you're wanting to do is to get the color for a specific class
> declaration, then I'd read the stylesheets to do that.
>
> If you're want to know what the *actual* color of a specific element might
> be if a certain class is applied, then you have to follow the rules of CSS
> to ensure you gather the right question.
>
> Also, while I agree adding the element to the DOM is hackish, you can add
> with an absolute position and visibility that's hidden. That way there's no
> visual clue that it's been added to the DOM tree. Still hackish, but you're
> at least guaranteed that your getting the color *exactly* how its being
> shown in the current browser.
>
> -Dan

Reply via email to