2013-05-22 14 views

回答

10

Working FIDDLE Demo

你可以用CSS Transitions做到這一點:

a { 
    color: lime; 
    -webkit-transition: color 1s; 
    -moz-transition: color 1s; 
    -ms-transition:  color 1s; 
    -o-transition:  color 1s; 
    transition:   color 1s; 
} 

a:hover { 
    color: red; 
} 
0

正如@elclanrs所說,或者你也可以使用它。

$("selector").hover(function(){ 
    // your code to fade in or fade out .... 
}); 
+2

他沒有說他正在使用jQuery –

+0

@亞歷克斯:是的,你是對的... 我只是給了他另一個選擇,如果他想使用。 – Janak

1

使用CSS過渡.. 看到這個:Fiddle

a { 
    color: #000000; 
} 
a:hover { 
    color: #E24B3B; 
} 
ul a { 
-webkit-transition: color 0.2s ease-out; 
-moz-transition: color 0.2s ease-out; 
-o-transition: color 0.2s ease-out; 
-ms-transition: color 0.2s ease-out; 
transition: color 0.2s ease-out; 
} 
0

嘗試

a { 
    color: red; 

-webkit-transition: color 0.2s ease-out; 
-moz-transition: color 0.2s ease-out; 
-o-transition: color 0.2s ease-out; 
-ms-transition: color 0.2s ease-out; 
transition: color 0.2s ease-out; 
} 
a:hover { 
    color: blue; 
}