I have a particular challenge, and is killing me, because I don't know how to do what I am trying to.
I have 5 items: 4 divs with width and height 50px and the body.
And I want create a function that sets the background-color for these items, for example:
var colors = ['red', 'blue', 'green', 'black', 'pink'];
div1 = red
div2 = blue
div3 = green
div4 = black
body = pink
and if the browser reload, they change:
div1 = pink
div2 = red
div3 = blue
div4 = green
body = black
and if the browser change the same happens...
There is any jquery plugin that do that? I don't know where start.. i already create the array with the items, inside a function:
HTML:
<body>
<div></div>
<div></div>
<div></div>
<div></div>
</body>
JS:
function changeColors() {
var colors = ['red', 'blue', 'green', 'black', 'pink'];
}
changeColors();