简体   繁体   English

CSS转换旋转仅在Firefox上有效

[英]CSS Transform rotate works only on Firefox

I already widely searched on Google and Stackoverflow, but couldn't find a solution. 我已经在Google和Stackoverflow上进行了广泛搜索,但是找不到解决方案。 I made a simple mobile menu with some cool animations. 我制作了一个简单的移动菜单,其中包含一些很酷的动画。

Here is the codepen: Codepen link 这是codepen: Codepen链接

The problem should be in these lines, but I don't understand what's wrong. 问题应该出在这些方面,但我不明白怎么了。

.menu a:hover:before {
    right: 100%;
    visibility: visible;
    -webkit-transform: scaleY(1) rotate(360deg);
    transform: scaleY(1) rotate(360deg);
}

When you hover the menu, the bars rotate (and it works even on chrome and opera) and change color. 当您将鼠标悬停在菜单上时,这些条会旋转(即使在Chrome和Opera上也可以使用)并更改颜色。 If you click it, they rotate again to form a X (and it works even on chrome and opera). 如果单击它,它们将再次旋转以形成X(即使在chrome和Opera上也可以使用)。 When the menu appears, if you hover the links there's a bar that (should) rotate and go from right to left. 出现菜单时,如果将链接悬停,则有一个栏(应)从右向左旋转。 If you do it in Firefox it works fine, the bars on the links appears smoothly and rotate from right to left, if you do it on Chrome or Opera, they just appear in the middle and go straight to the left. 如果您在Firefox中运行正常,则链接上的条会平滑显示并从右向左旋转;如果您在Chrome或Opera中进行操作,则它们会出现在中间并直接向左移动。

Check the codepen, I already inserted browser keywords (ie -webkit- ) and tried some options but no way to make it working. 检查代码笔,我已经插入了浏览器关键字(即-webkit- )并尝试了一些选项,但没有办法使其起作用。

Thanks in advance! 提前致谢!

.menu a:before {

  -webkit-transform: scaleY(0) rotate(0deg);
  transform: scaleY(0) rotate(0deg);
  -webkit-transition: all 1s ease-in-out 0s;
  transition: all 1s ease-in-out 0s;
}

.menu a:hover:before {
  right: 100%;
  visibility: visible;
  -webkit-transform: scaleY(1) rotate(360deg);
  transform: scaleY(1) rotate(360deg);
}

works for me if i add rotate(0deg) to the "default" state of the before pseudo element 如果我在前面的伪元素的“默认”状态下添加rotate(0deg),对我有用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM