2017-02-16 62 views
1

我遇到了Internet Explorer 11中粘滯左側欄的問題。我目前的解決方案正在使用Chrome和Firefox。我試圖使用CSS Polyfill,fixed-sticky,但仍然存在格式問題 - 當位置變得固定時,側邊欄右側的內容跳到左側並與側邊欄重疊。感謝您的想法。這是代碼的樣子:位置:Internet Explorer中的粘滯邊欄

.contentWithSidebar-wrapper { 
 
    display: table; 
 
    height: 100vh; 
 
} 
 

 
.content-wrapper { 
 
    padding-left: 10px; 
 
    display: table-cell; 
 
    width: 100%; 
 
    vertical-align: top; 
 
} 
 

 
.sidebar-wrapper { 
 
    position: relative; 
 
    display: table-cell; 
 
    vertical-align: top; 
 
} 
 

 
.sidebar-wrapper .sidebar { 
 
    position: sticky; 
 
    height: 100vh; 
 
}
<div> 
 
    <div class="contentWithSidebar-wrapper"> 
 
    <div class="sidebar-wrapper"> 
 
     <div class="sidebar"> 
 
     Sidebar content 
 
     </div> 
 
    </div> 
 
    <div class="content-wrapper"> 
 
     <div class="container-fluid"> 
 
     Page content 
 
     </div> 
 
    </div> 
 
    </div> 
 
</div>

+1

您的瀏覽器支持'position:sticky'嗎? –

+0

爲了幫助您回答這個問題:https://developer.mozilla.org/en/docs/Web/CSS/position#Browser_compatibility – Eria

回答

0

如果其他人是否有類似的問題,JavaScript解決方案here就是幫我解決這個問題。