css - Fading text color using JavaScript -


i have simple script changes color of navigation links when mouse hovered on it:

function fadetonormal(element) {     element.style.color = "#000000"; }  function fadetoselected(element) {     element.style.color = "#990099"; } 

now want try "fade" colors of links better looking transition. there way pure javascript?

you should css alone..

.fade-effect{    transition: color 0.5s;    color:#000000;  }  .fade-effect:hover{    color:#990099;  }
<a href="#" class="fade-effect">link #1</a>  <a href="#" class="fade-effect">link #2</a>


if have javascript, have break color rgb values, manually/programmatically animate them , while doing apply them element in question..


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -