簡體   English   中英

當打開多個標簽時,為什么固定位置元素在全屏iPhone體驗中被切斷?

[英]Why is fixed position elements being cut off on full-screen iPhone experience when multiple tabs are open?

我在畫布上方的固定位置UI元素上擁有全屏,不可滾動的交互式體驗。 在我測試過的每種瀏覽器中,這種體驗都很好,但是在iPhone上,當打開多個選項卡時,頁面頂部被截斷。

這是一個非常簡化的代碼示例...

http://codepen.io/anon/pen/rVEOgw

 <style> #interface { position: fixed; z-index: 100; top: 0; bottom: 0; left: 0; right: 0; } #logo { position: fixed; z-index: 100; top: 0; left: 0; } #nav { position: fixed; z-index: 200; bottom: 50px; left: 0; } #background { position: fixed; z-index: 0; top: 0; bottom: 0; left: 0; right: 0; background-color: #333; } </style> <div id="interface"> <div id="logo"> <a href="#"><img src="http://www.grandinroad.com/wcsstore/images/GrandinRoad/logo.png" /></a> </div> <div id="nav"> <button>&lt; Previous</button> | <button>Next &gt;</button> </div> </div> <div id="background"> <!-- BACKGROUND --> </div> 

任何想法如何解決?

是否有可能您依賴於高度為100%的屏幕並且將元素定位在底部:0? 在這種情況下,您應該閱讀此文章,因為100vh無法覆蓋iOS 8中的完整視口: http ://nicolas-hoizey.com/2015/02/viewport-height-is-taller-than-the-visible- 該文檔的一部分在某些移動瀏覽器.html

我能夠使用底部對齊的固定位置元素來解決我的問題-顯然我正在使用CSS hack來強制GPU加速,因此導致瀏覽器錯誤地呈現了我的固定位置元素。

.force-gpu {
   -webkit-transform: translate3d(0, 0, 0);
   -moz-transform: translate3d(0, 0, 0);
   -ms-transform: translate3d(0, 0, 0);
   transform: translate3d(0, 0, 0);
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM