简体   繁体   English

CSS3转换无法在Chrome上正确呈现(在Firefox上有效)

[英]css3 transform not rendering properly on chrome (works on firefox)

I have a div, on which I am applying css3 transform to make it look 3d & these transforms change as per the mousewheel events. 我有一个div,在其上应用css3转换以使其看起来为3d,并且这些转换根据mousewheel事件而变化。

First look at the div (the brown board with dots) in normal state: 首先查看正常状态下的div(带点的棕色木板):

在此处输入图片说明

Now I apply this small css code to transform it! 现在,我将使用此小型CSS代码对其进行转换!

.board-class{
    transform-style: preserve-3d;
    transform-origin: center top;
    transform: translateY(0) rotateX(30deg);
}

you can guess what this code will do, right? 您可以猜出这段代码会做什么,对吧? But it does not work in expected way, this is how it renders on chrome: 但是它不能以预期的方式工作,这就是它在chrome上的渲染方式:

在此处输入图片说明

But on Firefox this work well without issue: 但是在Firefox上,它运行良好,没有问题:

在此处输入图片说明

Here is link to hosted site : http://www.buildactivityboard.com/how-it-works 这是指向托管站点的链接: http : //www.buildactivityboard.com/how-it-works

Can anyone guide me what I am doing wrong, this seems like a silly issue but I can't find out what I am doing wrong. 谁能指导我做错了什么,这似乎是一个愚蠢的问题,但我找不到我做错的事情。

Note: 注意:

Believe me, this used to work without issue on Chrome too! 相信我,这在Chrome上也可以正常使用! I don't know what happened now to cause this problem. 我不知道现在发生了什么导致此问题。 I've checked this on Mac & Windows, behaviour remains same! 我已经在Mac和Windows上进行了检查,行为仍然相同!

Changing the position from static to absolute fixes the issue: 将位置从静态更改为绝对可解决此问题:

.master-board .widget-board {
  width: 750px;
  height: 300px;
  padding: 0;
  position: absolute;
  left: 50vw;
  top: 50vh;
  margin: -96px 0 0 -375px;
  z-index: 1000;
  transition: all 1.5s;
}

https://bugs.chromium.org/p/chromium/issues/detail?id=20574 https://bugs.chromium.org/p/chromium/issues/detail?id=20574

Either adding perspective: 1000px to body or .master-board works. 添加perspective: 1000px body.master-board作品添加perspective: 1000px

EDIT: According to this post , seems like it's caused by a conflict between 3d transforms and position:fixed. 编辑:根据这篇文章 ,似乎是由3d转换和position:fixed之间的冲突引起的。 The chromium bug tracker marked this issue as "wont fix". 铬错误跟踪器将此问题标记为“无法修复”。

I've created a fiddle to reproduce this issue: https://jsfiddle.net/uuhqsw57/ 我创建了一个小提琴来重现此问题: https : //jsfiddle.net/uuhqsw57/

Adding perspective to its nearest parent helped solve the issue. 向最接近的父级添加视角有助于解决此问题。

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

相关问题 具有多个属性的css转换适用于Firefox,但不适用于chrome - css transform with multiple attributes works on firefox but not in chrome jQuery CSS渲染 - 适用于Firefox,而不适用于Chrome - jQuery CSS rendering - works in Firefox, not in Chrome CSS3关键帧动画在Chrome(而非Firefox)中运行 - CSS3 Keyframe animation working in chrome, not firefox CSS 变换旋转不在 Webkit / iPhone 上呈现(但在 Chrome Devtools 设备工具栏中有效) - CSS transform rotate not rendering on Webkit / iPhone (but works in Chrome Devtools device toolbar) CSS转换旋转仅在Firefox上有效 - CSS Transform rotate works only on Firefox CSS3转换不使用javascript事件处理程序和函数在firefox中触发 - CSS3 transform not firing in firefox with javascript event handlers and functions css3动画-转换:在firefox 45.0上为scale3D - css3 animation - transform: scale3D on firefox 45.0 JQuery CSS转换可在Chrome和Firefox中运行,但不能在IE中运行 - JQuery CSS Transform Working in Chrome and Firefox but Not IE 在Chrome中可以在Javascript中设置CSS 3 Transition and Transform,但在IE 10,FF中不能正常使用吗? - Setting CSS 3 Transition and Transform in Javascript works in Chrome But not in IE 10, FF properly? Firefox和Chrome中的CSS网格呈现方式不同 - css-grid rendering differently in Firefox and Chrome
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM