I have three classes with three different colors. How can I randomly change background-colorson every page visit?
Fiddle
.projects{background:#99c6c3;}
.other-things{background:#d3d3d3;}
.about {background:#eedd8d;}
I tried using this js:
var bgcolorlist=new Array("#99c6c3", "#d3d3d3", "#eedd8d")
$(".projects").css("background-color",bgcolorlist[Math.floor(Math.random()*bgcolorlist.length)]);
But I do not want the two colors to be the same.
source
share