axetroy / axetroy/stackoverflow

iOS safari设置平滑滚动后,fixed定位错误

Open
#16 0 comments 0 reactions 0 assignees View on GitHub
移动端开发
Dominant language
No language data
Stars
3
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Safari 设置平滑滚动
```css
body {
-webkit-overflow-scrolling:touch;
}
```

如果页面有``position: fixed``的元素,那么页面布局会错乱

则需要设置transform

```css
.element {
position: fixed;
transform: translateZ(0);
-webkit-transform: translateZ(0);
}
```

相关问题

https://stackoverflow.com/questions/22167382/position-fixed-not-working-on-windows-safari

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.