Organizational Research By

Surprising Reserch Topic

how to get a style attribute from a css class by javascript jquery


how to get a style attribute from a css class by javascript jquery  using -''

How can I access a property from a CSS class by jQuery?
I have a CSS class like:

.highlight {
    color: red;
}


And I need to do a color animation on an object:

$(this).animate({
    color: [color of highlight class]
}, 750);


So that I can change from red to blue (in the CSS) and my animation will work in accordance with my CSS.

One approach would be to place an invisible element with the highlight class and then get the color of the element to use in the animation, but I guess this is a very, very bad practice.

Any suggestions?
    

asked Oct 13, 2015 by thiru
0 votes
35 views



Related Hot Questions

7 Answers

0 votes
NULL
answered Oct 13, 2015 by shikhar jain
0 votes
NULL
answered Oct 13, 2015 by yogeshplv
0 votes
NULL
answered Oct 13, 2015 by deven.bendale
0 votes
NULL
answered Oct 13, 2015 by virendra.bajaj
0 votes
NULL
answered Oct 13, 2015 by ajit.chavhan
0 votes
NULL
answered Oct 13, 2015 by manju bhargava
0 votes
NULL
answered Oct 13, 2015 by devkumargupta

...