2015-06-03 78 views
1

這裏是我的CSS類背景圖片(居中)在iPhone

.parallax { 
     background: url(../images/indexParallax.png) no-repeat center center fixed; 
     display: table; 
     height: 100%; 
     position: relative; 
     width: 100%; 
     -webkit-background-size: cover; 
     -moz-background-size: cover; 
     -o-background-size: cover; 
     background-size: cover; 
     overflow: hidden; 
} 

在臺式電腦和Android手機,正確顯示該視差。但是當涉及到iPhone(4和5和6)時,就會出現問題。圖像顯示但沒有正確縮放背景圖像。

任何想法?謝謝。

+0

我相信'背景附件:fixed'不會在iOS – zgood

回答

0

我還沒有嘗試過這個自己,但這裏是一個應該解決

-webkit-background-size: 100%; 
-moz-background-size: 100%; 
-o-background-size: 100%; 
background-size: 100%; 
-webkit-background-size: cover; 
-moz-background-size: cover; 
-o-background-size: cover; 
background-size: cover; 

基本上,如果瀏覽器無法使用蓋,然後它會採取100%,這應該提供類似的結果。

background-size: cover;bugged在iOS

+0

Unforunately -webkit-背景大小的某些版本中工作:100%;沒有達到與-webkit-background-size:cover相同的結果;這應該是視差,當我設置100%時,那只是我們沒有覆蓋整個背景的圖像 – user3100193