CSS转换在Edge中不起作用

时间:2015-12-16 16:39:27

标签: html css css-transforms microsoft-edge

我遇到了以下问题。

this site that I created上,我有一个位于页面底部的图库。如果我将鼠标悬停在拇指上,它们会疯狂地飞来飞去,这不是我想要的。它就像其他浏览器的魅力一样;只有Microsoft Edge受到影响。

有人可以帮助我让图像按预期运行吗?

CSS看起来像这样:

.node-gallery {
   float: left;
   width: 150px;
   height: 150px;
   position: relative;
   margin: 0 60px 50px 0;
}

.node-gallery img {
   position: absolute;
   bottom: 0px;
}

.node-gallery .image1 {
   left: 0px;
   z-index: 3;
   -webkit-transition: all 0.2s ease;
   -moz-transition: all 0.2s ease;
   -o-transition: all 0.2s ease
}

.node-gallery .image2 {
   left: 7px;
   height: 148px;
   z-index: 2;
   -webkit-transition: all 0.2s ease;
   -moz-transition: all 0.2s ease;
   -o-transition: all 0.2s ease
}

.node-gallery .image3 {
   left: 14px;
   height: 145px;
   z-index: 1;
   -webkit-transition: all 0.2s ease;
   -moz-transition: all 0.2s ease;
   -o-transition: all 0.2s ease
}

.image1, .image2, .image3 {
   border: 5px solid #F3F3F3!important;
   box-shadow: 1px 1px 2px #666;
   -webkit-shadow: 1px 1px 2px #666;
   -webkit-transform: rotate(0deg) translate(0px);
}

.node-gallery:hover .image1 {
   z-index: 6;
   -ms-transform: rotate(-5deg) translate(-20px, -2px);
   -ms-transform-origin: center bottom;
   -webkit-transform: rotate(-5deg) translate(-20px, 2px);
   -webkit-transform-origin: center bottom;
   -moz-transform: rotate(-5deg) translate(-20px, -2px);
   -moz-transform-origin: center bottom;
   -o-transform: rotate(-5deg) translate(-20px, -2px);
   -o-transform-origin: center bottom;
}

.node-gallery:hover .image2 {
   z-index: 5;
   -ms-transform: rotate(-2deg) translate(0px, 2px);
   -ms-transform-origin: center bottom;
   -webkit-transform: rotate(-2deg) translate(0px, -2px);
   -webkit-transform-origin: center bottom;
   -moz-transform: rotate(-2deg) translate(0px, 2px);
   -moz-transform-origin: center bottom;
   -o-transform: rotate(-2deg) translate(0px, 2px);
   -o-transform-origin: center bottom;
}

.node-gallery:hover .image3 {
   z-index: 4;
   -ms-transform: rotate(5deg) translate(20px, -2px);
   -ms-transform-origin: center bottom;
   -webkit-transform: rotate(5deg) translate(20px, 2px);
   -webkit-transform-origin: center bottom;
   -moz-transform: rotate(5deg) translate(20px, -2px);
   -moz-transform-origin: center bottom;
   -o-transform: rotate(5deg) translate(20px, -2px);
   -o-transform-origin: center bottom;
}

4 个答案:

答案 0 :(得分:9)

几个月后,我相信我刚遇到同样的错误并找到了解决方案。似乎Microsoft Edge 13在解释transform-origin的一些通常可接受的值时遇到问题。特别是对我来说,它忽略了值right center,但与top left一起正常工作,让我相信center值(我在示例代码中看到)可能是问题。

我的修复方法是使用百分比值,因此transform-origin: center bottom将成为transform-origin: 50% 100%。希望这可以帮助遇到此问题的任何人。

请注意,尽管顶级投票的答案提示ms-前缀,但这个问题与最近的MS Edge浏览器有关,并且自Internet Explorer 9以来,对于转换属性不需要该前缀(每{{3} }})。

答案 1 :(得分:3)

<强> 版。另一个用户:此答案不适用于Microsoft Edge浏览器。

您需要编写标准的transitiontransform属性,然后编写用于Microsoft Internet Explorer的-ms前缀:

 .selector {
     -webkit-transform: scale(); /* android, safari, chrome */
     -moz-transform: scale(); /* old firefox */
     -o-transform: scale(); /* old opera */
     -ms-transform: scale(); /* old IE */
     transform: scale(); /*standard */
  }

transition属性中的相同内容。您的解决方案是编写标准。

答案 2 :(得分:-1)

我发现了一些差异:

当我尝试使用 display:inline 旋转(变换)元素时,这在 EDGE 中不起作用。

但是,当我使用 display: inline-block 然后转换工作。

试试这个(在 MS EDGE 中):

<style>
 #good span { display: inline-block; transform: rotate(-10deg); }
 #bad span { transform: rotate(-10deg); }
</style>

<div id="good"><span>WELCOME</span></div>

<div id="bad"><span>WELCOME</span><div>

答案 3 :(得分:-4)

尝试做到这一点,

您的图库图片使用fancybox API.SO可以选择更改fancybox.js中的动画类型。

<强>参考:http://fancybox.net/api

你需要去fancybox js文件,找到'transitionIn,transitionOut'改变为转换类型的效果。可以设置为“弹性”,“淡出”或“”。

根据Windows所有浏览器都可以。