I have the following code:
// Vegas
// $(".bg-fixed").vegas({
// slides: [
// { src: "/img/fundos/slide1.jpg" },
// { src: "/img/fundos/slide2.jpg" },
// { src: "/img/fundos/slide3.jpg" }
// ],
// overlay: '/js/vegas/overlays/03.png'
// });
//$(".bg-fixed").vegas();
var height = $(window).height();
var width = $(window).width();
var fundo = '';
//var x = 0;
function setBackground() {
d = new Date();
data1 = d.getTime();
fundo = 'https://unsplash.it/g/' + width + '/' + height + '?random?' + data1;
console.log(fundo)
var slides = $(".bg-fixed").vegas('options', 'slides');
slides.push({src:fundo});
//$(".bg-fixed").vegas('options', 'transition', 'slideLeft2').vegas('next');
$(".bg-fixed")
.vegas('options', 'slides', slides)
.vegas('options', 'transition', 'slideDown')
.vegas('options', 'overlay', '/js/vegas/overlays/03.png')
.vegas('jump', slides.length - 1)
.vegas('options', 'transition', 'slideLeft2');
delete fundo;
}
setBackground();
setInterval(setBackground, 10000);
The goal is to get a new link image every ten seconds.
But the image is always the same ...
I can not clean the varable background with a new value.
If you need the complete code or the site link I can send.