固定位置在Windows Safari上不起作用 [英] Position fixed not working on Windows Safari

查看:107
本文介绍了固定位置在Windows Safari上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了位置固定的画廊问题;网站内容正在其上滚动.该位置固定适用于除Windows 7上的Safari以外的所有单个浏览器(是的,即使在IE8和Mac上的Safari中也可以.)

顶部已定义,但它仍然是相对位置,并向下滚动其余内容.

解决方案

解决方案是在该位置定义z-index:fixed;元素.由于某些原因,仅在Windows Safari上位置:固定;在定义任何z-index之前,该功能不起作用.

后来,我发现此错误可能是由页面上某些固定元素具有的-webkit-transform属性引起的.

此外,我发现在固定元素上设置此设置可能会有所帮助:

-webkit-transform: translateZ(0);

I had a problem with gallery that is position:fixed; and the site content is scrolling over it. That position fixed worked in every single browser except in Safari on Windows 7 (yes it worked even in IE8, and Safari on Mac).

Top is defined, but yet it still act as a position relative and scroll down with the rest of the content.

解决方案

The solution was to define the z-index on that position:fixed; element. For some reason only on Windows Safari position:fixed; didn't work until any z-index was defined.

Later, I discover that this bug is probably caused by -webkit-transform property that some of the fixed elements on page have.

Also, I found that setting this on that fixed element could help:

-webkit-transform: translateZ(0);

这篇关于固定位置在Windows Safari上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆