Positions fixed doesn#39;t work when using -webkit-transform(使用 -webkit-transform 时固定位置不起作用)
问题描述
我正在使用 -webkit-transform(和 -moz-transform/-o-transform)来旋转 div.还添加了固定位置,以便 div 与用户一起向下滚动.
I am using -webkit-transform (and -moz-transform / -o-transform) to rotate a div. Also have position fixed added so the div scrols down with the user.
在 Firefox 中它可以正常工作,但在基于 webkit 的浏览器中它就坏了.使用 -webkit-transform 后,固定位置不再起作用!这怎么可能?
In Firefox it works fine, but in webkit based browsers it's broken. After using the -webkit-transform, the position fixed doesn't work anymore! How is that possible?
推荐答案
经过一番研究,有一个Chromium 网站上关于此问题的 20574" rel="noreferrer">错误报告,到目前为止,Webkit 浏览器还不能同时渲染这两种效果.
After some research, there has been a bug report on the Chromium website about this issue, so far Webkit browsers can't render these two effects together at the same time.
我建议在样式表中添加一些仅适用于 Webkit 的 CSS,并将转换后的 div 设为图像并将其用作背景.
I would suggest adding some Webkit only CSS into your stylesheet and making the transformed div an image and using it as the background.
@media screen and (-webkit-min-device-pixel-ratio:0) {
  /* Webkit-specific CSS here (Chrome and Safari) */
  #transformed_div {
    /* styles here, background image etc */
  }
}
所以现在你必须用老式的方式来做,直到 Webkit 浏览器赶上 FF.
So for now you'll have to do it the old fashioned way, until Webkit browsers catch up to FF.
截至 2012 年 10 月 24 日,该错误尚未解决.
As of 10/24/2012 the bug has not been resolved.
这似乎不是一个错误,而是规范的一个方面,因为这两种效果需要单独的坐标系和堆叠顺序.如本答案所述.
This appears to not be a bug, but an aspect of the specification due to the two effects requiring separate coordinate systems and stacking orders. As explained in this answer.
这篇关于使用 -webkit-transform 时固定位置不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 -webkit-transform 时固定位置不起作用
 
				
         
 
            
        基础教程推荐
- 如何在特定日期之前获取消息? 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
 
    	 
    	 
    	 
    	 
    	 
    	 
    	 
    	 
						 
						 
						 
						 
						 
				 
				 
				 
				