2017-03-03 34 views
1

我這是在頁面的響應目的左邊這個元素有一個overflow:auto上貼了側邊欄,一切完美,但問題是我要支持原生的Android 4.2瀏覽器,不適用此屬性。溢出:auto;不工作的Android 4.2瀏覽器

我的應用程序與角2發,我試圖執行一個指令或模塊,但我得到了同樣的問題。

有沒有人知道解決這個問題的最好方法?

這是我的結構:

<nav class="navigation"> 
    <div class="navigation__scroll"> 
     * Content goes here * 
    </div> 
</nav> 

CSS

.navigation { 
    position: fixed; 
    background-color: $light_blue; 
    width: 275px; 
    height: 100%; 
    top: 71px; 
    left: -275px; 
    border-top: 10px solid $primary_blue; 
    z-index: 100; 
    transition: all .5s ease; 

    .navigation__scroll { 
    height: calc(100% - 71px); 
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch; 
    } 

回答

1

恐怕不是overflow:auto;,這不是在Android 4.2版本的瀏覽器,但calc(100% - 71px)。可惜的是,有一個爲它沒有適當的解決方法,不是指定以外的硬編碼的calc()規則之前max-heightheight

實施例:

.navigation__scroll { 
    height: 90%; 
    height: calc(100% - 71px); 
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch; 
} 

最佳做法是基於流行的移動尺寸硬編碼值height

+0

哇,這一招解決了我的問題,並作出一切乾淨。非常感謝。 – Alex