V
V
Vladimir Fedorov2015-09-21 16:04:05
css
Vladimir Fedorov, 2015-09-21 16:04:05

How to change the background?

It is not exactly monotonous colors that are needed, but for the picture of the entire wrapper to change

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
DVamp1r3, 2015-09-21
@DVamp1r3

change background on event?

D
Denis Ineshin, 2015-09-21
@IonDen

Something like this:

var imgs = [
    "url_1.jpg",
    "url_2.jpg",
    "url_3.jpg",
    "url_4.jpg",
    "url_5.jpg"
];

var counter = 0;
var length = imgs.length;
var $wrapper = $("#wrapper");

setInterval(function () {
    counter++;
    if (counter > length - 1) {
        counter = 0;
    }

    $wrapper.css("backgroundImage", "url(" + imgs[counter] + ")");
}, 10000);

K
Kirill Turovnikov, 2015-09-21
@turovnikoff

If you need a nominal smooth change in the background color, then a long time ago I wrote a simple script jsfiddle.net/straj/9g2wrx81

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question