HTML-низ:
Код:
<script type="text/javascript"> var color, href, time_color, rate=20, elmH=0, elmS=128, elmV=255; function rotationColor(){ if(elmS==0){elmR=elmV;elmG=elmV;elmB=elmV;} else {t1=elmV;t2=(255-elmS)*elmV/255; t3=elmH%60;t3=(t1-t2)*t3/60; if(elmH<60){elmR=t1;elmB=t2;elmG=t2+t3;} else if(elmH<120){elmG=t1;elmB=t2;elmR=t1-t3;} else if(elmH<180){elmG=t1;elmR=t2;elmB=t2+t3;} else if(elmH<240){elmB=t1;elmR=t2; elmG=t1-t3;} else if(elmH<300){elmB=t1;elmG=t2;elmR=t2+t3;} else if(elmH<360){elmR=t1;elmG=t2;elmB=t1-t3;} else {elmR=0;elmG=0;elmB=0;}} elmR = Math.floor(elmR); elmG = Math.floor(elmG); elmB = Math.floor(elmB); clrRGB='#'+elmR.toString(16)+elmG.toString(16)+elmB.toString(16); elmH=elmH+rate; if(elmH>=360) elmH=0; href.css({'color':clrRGB}); } $('a').hover(function(){href=$(this); color=$(this).css('color'); time_color=setInterval ('rotationColor()',100)},function(){clearInterval(time_color); $(this).css({'color':color});}); </script>