Search code examples
jquerycsseffectsfadeinjquery-effects

jQuery fade elements from one class to another, on hover


can this be done?

for eg.

.class1{
  background-image:(whatever.jpg)
  color: #fff;
}

.class2{
  background-image:(whatever2.jpg)
  color: #999;
}

can I fade all elements that have class1 to class2 when the mouse is over the element, and back to class1 when mouse is out?


Solution

  • If you give both the same absolute position, using fadeIn() and fadeOut() will have this effect (attached to onmouseover and onmouseout).