是否可以在更改背景中添加动画。我试过这样的CSS3
财产transition
background and background-image
:
var affected_element = $('body');
affected_element.css('min-height', '100%');
affected_element.css('min-width', '100%');
affected_element.css('background-size', 'cover');
affected_element.css('transition', 'background 1s');
affected_element.css('-moz-transition', 'background 1s');
affected_element.css('-webkit-transition', 'background 1s');
affected_element.css('-o-transition', 'background 1s');
var config = $('.fullscreen_src');
affected_element.css('background-image', "url('" + config[0].src + "')");
imageIndex = 1,
setInterval(function(){ affected_element.css('background-image', "url('" + config[imageIndex++ % config.length].src + "')" ) }, 3000);
但我没有看到过渡正在产生任何影响?我做错了什么还是有更简单的方法可以做到这一点?