$(window).scroll(function(){
var posicao = $(window).scrollTop();
var cor = Math.round(posicao / 1000);
$('.social li a').css('border-color', pegarCor(cor));
});
pegarCor = function(cor){
switch(cor){
case 1:
return "#ff0ff0";
break;
case 2:
return "#00aabc";
break;
case 3:
return "#00ee54";
break;
case 4:
return "#334454";
break;
case 5:
return "#ff00ff";
break;
default:
return "#00aa12";
break;
}
}
<!-- codigo jquery -->
$(window).scroll(function(){
var posicao = $(window).scrollTop();
var cor = Math.round(posicao / 1000);
$('.social li a').css('border-color', pegarCor(cor));
});
pegarCor = function(cor){
switch(cor){
case 1:
return "#ff0ff0";
break;
case 2:
return "#00aabc";
break;
case 3:
return "#00ee54";
break;
case 4:
return "#334454";
break;
case 5:
return "#ff00ff";
break;
default:
return "#00aa12";
break;
}
}
<!-- codigo javascript -->
window.onscroll = function(){
var position = window.scrollTop;
var color = Math.round(position / 1000);
document.querySelectorAll(".social li a").style.borderColor = selectColor(color);
}
selectColor = function(color){
switch(color){
case 1:
cor = "#ff0ff0";
break;
case 2:
cor = "#00aabc";
break;
case 3:
cor = "#00ee54";
break;
case 4:
cor = "#334454";
break;
case 5:
cor = "#ff00ff";
break;
default:
cor = "#00aa12";
break;
}