CSS transition [background-image property] 仅适用于 chrome

标签 css css-transitions

我发布了一个网站:http://semep.com.br

此页面上每个横幅的背景照片都已修改。 我想在照片中放置一个过渡效果作为背景淡入淡出:

CSS 规则

#fullbackground{

    /* Set rules to fill background */
    min-height: 100%;
    min-width: 1024px;

    /* Set up proportionate scaling */
    width: 100%;
    height: auto;

    /* Set up positioning */
    position: fixed;
    top: 0;
    left: 0;

    transition: background-image 800ms ease-in-out;
     -moz-transition: background-image 800ms ease-in-out;
     -ms-transition: background-image 800ms ease-in-out;
     -o-transition: background-image 800ms ease-in-out;
    -webkit-transition: background-image 800ms ease-in-out; 
}

更改背景图片的脚本

  window.modificarBackground = function(bgArquivo) {
    if (screen.width > 1280) {
      bgArquivo = "url('/Images/Fundo/1600/" + bgArquivo + "')";
    }
    if (screen.width <= 1024) {
      bgArquivo = "url('/Images/Fundo/1024/" + bgArquivo + "')";
    }
    if (screen.width > 1024 && screen.width <= 1280) {
      bgArquivo = "url('/Images/Fundo/1280/" + bgArquivo + "')";
    }
    return $("#fullbackground").css("background-image", bgArquivo);
  };

在 chrome 中完美运行!

在其他浏览器中这种效果只是白屏!

最佳答案

我知道您正在尝试使用 CSS,但是使用 jQuery 呢?我最近想做类似这样的事情。我使用了 fadeIn 和 fadeOut 函数。这些可能对您有所帮助。

这些链接可能会有帮助:

http://api.jquery.com/fadeIn/

http://api.jquery.com/fadeOut/

关于CSS transition [background-image property] 仅适用于 chrome,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11435660/

相关文章:

html - 如何在html中找到类定义?

css3 旋转不会在悬停时返回

css - 元素在 Safari、Chrome 和 FF 中获得蓝色背景是可以的

javascript - 如果无法访问原始代码,是否有 html 或 js 代码为 GoDaddy 模板发送按钮提供视觉焦点

html - 为什么这个菜单导航 <div> 没有居中对齐?

html - 将比屏幕宽的 div 对齐到中心并 overflow hidden

html - 出现在文本段落中时 DIV 上方的空间(工具提示)

css - IE10/11 使用转换 :-webkit-transform?

jQuery Append/CSS 转换冲突

圆形元素的 CSS 边框过渡