1
I would like the tanposition between the colors to have a fade effect. Who knows using .fadein()
.
$(function () {
var colors = ["#0099cc", "#c0c0c0", "#587b2e", "#990000", "#000000", "#1C8200", "#987baa", "#981890", "#AA8971", "#1987FC", "#99081E"];
setInterval(function(){
var bodybgarrayno = Math.floor(Math.random() * colors.length);
var selectedcolor = colors[bodybgarrayno];
$("body").css("background", selectedcolor);
}, 3000);
})
If you use
fadeIn()
/fadeOut()
in your body all the content of your page will disappear along with it. If the goal is to change only the background color these two functions are not the most recommended.– Kazzkiq