Переливающиеся ссылки (RUSSIAN_GOBLIN, Deff)
Ставить в ХТМЛ-низ. Работает во всех браузерах.
Ужатая версия от Deff:
JQuery версия от RUSSIAN_GOBLIN:
Ужатая версия от Deff:
Код
<script>function Sparkling_links(){var rate=20,eH=0,eS=128,eV=255,a,i=0,clrOrg,aZ,TimerID;
a=document.links;for(i in a){a[i].onmouseover=function(){clrOrg=this.style.color;aZ=this;TimerID=setInterval(time,100)};a[i].onmouseout=function(){clearInterval(TimerID);this.style.color=clrOrg}};a=document.links;for(i in a){a[i].onmouseover=function(){clrOrg=this.style.color;aZ=this;TimerID=setInterval(time,100)};a[i].onmouseout=function(){clearInterval(TimerID);this.style.color=clrOrg}};function time(){aZ.style.color=makeColor()};function makeColor(){if(eS==0){eR=eV;eG=eV;eB=eV}else{t1=eV;t2=(255-eS)*eV/255;t3=eH%60;t3=(t1-t2)*t3/60;if(eH<60){eR=t1;eB=t2;eG=t2+t3}else if(eH<120){eG=t1;eB=t2;eR=t1-t3}else if(eH<180){eG=t1;eR=t2;eB=t2+t3}else if(eH<240){eB=t1;eR=t2;eG=t1-t3}else if(eH<300){eB=t1;eG=t2;eR=t2+t3}else if(eH<360){eR=t1;eG=t2;eB=t1-t3}else{eR=0;eG=0;eB=0}}eR=Math.floor(eR);eG=Math.floor(eG);eB=Math.floor(eB);clrRGB='#'+eR.toString(16)+eG.toString(16)+eB.toString(16);eH=eH+rate;if(eH>=360)eH=0;return clrRGB;}};Sparkling_links();
</script>
a=document.links;for(i in a){a[i].onmouseover=function(){clrOrg=this.style.color;aZ=this;TimerID=setInterval(time,100)};a[i].onmouseout=function(){clearInterval(TimerID);this.style.color=clrOrg}};a=document.links;for(i in a){a[i].onmouseover=function(){clrOrg=this.style.color;aZ=this;TimerID=setInterval(time,100)};a[i].onmouseout=function(){clearInterval(TimerID);this.style.color=clrOrg}};function time(){aZ.style.color=makeColor()};function makeColor(){if(eS==0){eR=eV;eG=eV;eB=eV}else{t1=eV;t2=(255-eS)*eV/255;t3=eH%60;t3=(t1-t2)*t3/60;if(eH<60){eR=t1;eB=t2;eG=t2+t3}else if(eH<120){eG=t1;eB=t2;eR=t1-t3}else if(eH<180){eG=t1;eR=t2;eB=t2+t3}else if(eH<240){eB=t1;eR=t2;eG=t1-t3}else if(eH<300){eB=t1;eG=t2;eR=t2+t3}else if(eH<360){eR=t1;eG=t2;eB=t1-t3}else{eR=0;eG=0;eB=0}}eR=Math.floor(eR);eG=Math.floor(eG);eB=Math.floor(eB);clrRGB='#'+eR.toString(16)+eG.toString(16)+eB.toString(16);eH=eH+rate;if(eH>=360)eH=0;return clrRGB;}};Sparkling_links();
</script>
JQuery версия от RUSSIAN_GOBLIN:
Код
<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>
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>
Просмотров: 601, Загрузок: 0, Оценка: 5.0 (1)
Страницы: | |