Animate with fade the css style hover state with jQuery -


is possible fade animate css properties of 1 style jquery when hovering? , mean if have defined style , :hover state css, script rest. example:

.button1 { background: url(img1.jpg) repeat-x top left; color: #000; } .button1:hover { background: url(img2.jpg) repeat-x top left; color: #f00; } 

and if want jquery script same many similar buttons, possible? or way define 2 different css styles?

you replace hover css class , use jquery ui toggleclass animation:

css:

.button1:hover, .button1_hover_class {   background: url(img2.jpg) repeat-x top left;   color: #f00; } 

javascript:

$(".button1").hover(function() {     $(this).toggleclass("button1_hover_class", 1000);     return false; }); 

if want use both css hover , javascript hover, guess have cancel default action in javascript hover function.

edit: answer other question, javascript above applied buttons .button1 class if add .button2 too, can use example:

$(".button1, .button2").hover(function() { 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -