1

Lets say I had an element with multiple classes, one of these classes has a hover pseudo-class. Lets say this will change the colour.

So what I want to do is find out what colour the element will change to when hovered over. Then I want to override this with Javascript/jQuery.

asked Nov 18, 2009 at 17:54
6
  • 1
    why do you want to find out the color if you're just going to override it? Commented Nov 18, 2009 at 18:04
  • I thought about animating it with jQuery instead of it being an instant change. Also I'm curious to find out if it's possible. Commented Nov 18, 2009 at 18:09
  • @Ben - you can find out the css style of a certain class, so if the class is named hover then yes you can find out the color style, refer to this for help: quirksmode.org/dom/getstyles.html Commented Nov 18, 2009 at 18:27
  • @TStamper: But not for pseudo-classes? Commented Nov 18, 2009 at 18:47
  • @Ben- you probably can, but im not sure, but why not just change the fact that its a pseudo class into an actual class? Commented Nov 18, 2009 at 19:02

1 Answer 1

1

The animateToSelector jQuery plug-in seems to do what you want.

I found that plug-in through another question on StackOverflow. Also have a look at this question to see there isn't really any other way to do it but by going through document.styleSheets.

answered Nov 18, 2009 at 22:15
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.