2015-08-26 49 views
0

我試着這樣如何設置離子響應背景圖像?

.pane { 
     background: url('../img/fondoapp.png'); 
     background-size: 100% 100% !important; 
     background-position: center center; 
     background-repeat: no-repeat; 
     background-attachment: fixed; 
    } 

但使用.pane或.scrollcontent重複的背景圖像在我的其他選項卡,還當本地鍵盤出現調整大小的圖像。

+0

您能否檢查下面的答案? – Muhsin

+0

你想要背景? –

+0

是的,但只是在登錄 –

回答

4

所有伎倆,以適應背景圖像全要素首先是background-size: cover,現在你可以做這樣的

.view-with-bg{ 
    .view-content { 
    background-image: url('../img/fondoapp.png'); 
    background-size: cover; 
    } 
} 

現在類添加view-with-bg到該選項卡的<ion-view>,並添加view-content到特定元素(在你的情況是<ion-content>)你想要背景圖像的地方。 OR

.view-with-bg{ 
    .pane { 
    background-image: url('../img/fondoapp.png') !important; 
    background-size: cover !important; 
    } 
} 

而且只需添加view-with-bg到該選項卡的<ion-view>。這僅適用於特定頁面。此外,關於背景圖像技巧還有很好的post

+0

好的謝謝,但當本機鍵盤出現時,它仍然調整背景圖像的大小。 –

+0

鍵盤實際上是通過提出來調整內容的大小,這就是爲什麼背景被調整大小的原因。所以你應該找那個。 –

+0

@Morsiki如果此答案解決了您的問題相關問題,請標記爲已接受。 –