Computer Science, asked by RichyKing4301, 1 year ago

Change background according to array of color in javascript

Answers

Answered by rajmishra1218
0
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:

Similar questions