javascript - CSS 过渡不适用于 IE11

标签 javascript html css

我试图让粘性页脚从顶部淡入淡出到底部。我的代码似乎适用于 Google Chrome、Firefox 等。但它根本不适用于 IE11。 下面是我的 CSS 代码。 有谁知道如何解决这个问题?

.sticky-footer-show {
  overflow-y: hidden;
  -webkit-transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
       -o-transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
          transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
  
  -webkit-transition: all 1s;
  -o-transition: all 1s;
  transition: all 1s;
} //.sticky-footer-show

.sticky-footer-remove {
  -webkit-transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
       -o-transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
          transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
          
  -webkit-transition: all 1s;
  -o-transition: all 1s;
  transition: all 1s;
  height: 0;
} //.sticky-footer-remove

最佳答案

您可能正在寻找 -ms- 前缀

但根据这个答案 CSS3 + Javascript - Will -ms-transition:opacity 1s ease-in-out; work in IE 10 alone?,它也应该只与过渡一起工作

但是 Internet Explorer 就是 Internet Explorer,可能会有一些阻碍。

.sticky-footer-show {
  overflow-y: hidden;
  -webkit-transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
       -o-transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
      -ms-transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
          transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
  
  -webkit-transition: all 1s;
  -ms-transition: all 1s;
  -o-transition: all 1s;
  transition: all 1s;
} //.sticky-footer-show

.sticky-footer-remove {
  -webkit-transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
       -o-transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
      -ms-transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
          transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
          
  -webkit-transition: all 1s;
  -o-transition: all 1s;
  -ms-transition: all 1s;
  transition: all 1s;
  height: 0;
} //.sticky-footer-remove

您是否尝试过在转换命令中全部使用它?

 .sticky-footer-show, .sticky-footer-remove {
    -webkit-transition: transform 1s cubic-bezier(0, 1, 0.5, 1);
         -o-transition: transform 1s cubic-bezier(0, 1, 0.5, 1);
        -ms-transition: transform 1s cubic-bezier(0, 1, 0.5, 1);
            transition: transform 1s cubic-bezier(0, 1, 0.5, 1);
 }
 .sticky-footer-remove {
       height: 0;
 }

建议:不要尝试用花哨的图形 doda 来支持 IE11。让他们快速转移到其他状态,但让您的网页正常运行。现在将使用 IE11,因为一半的互联网都坏了,并在某个时候转移到 chrome/firefox/edge。

关于javascript - CSS 过渡不适用于 IE11,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49236833/

相关文章:

javascript - Meteor + ArcGIS JavaScript

javascript - 如果父 div 有超过 1 个子 div,那么将类添加到 body

javascript - Backbone 模型。销毁不触发删除请求

javascript - JQuery val() 仅在输入 2 个字符时才为 true

javascript - Bootstrap 模式不能按预期与 JS 一起工作

CSS 亮度和对比度动画

javascript - 仅当 parents ('.class' ).attr ('id' ) 存在时如何定义 $var?

html - Bootstrap .jumbotron

html - 删除图像中的间距

html - MailChimp HTML 电子邮件模板扩展表格行的部分背景