經過大量的研究,我unable to find a proper solution爲當固定位置元素,覆蓋圖像和標準內容,當模態窗口打開時右移。模態固定位置內容移位
注意:我在尋找一個一般的,乾淨的解決方案,而不是一個硬編碼的修復,將只是工作在一個特定的佈局。
有誰知道如何解決這個問題?請參考下面這個例子:http://codepen.io/microcipcip/pen/kXdRWK
body {
height: 2500px;
&.-modal-open {
overflow: hidden;
}
}
.fixed {
position: fixed;
top: 0;
left: 0;
width: 100%;
padding: 20px 0;
background: #FF0000;
}
.modal {
overflow-x: hidden;
overflow-y: scroll;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.4);
opacity: 0;
transition: opacity .2s ease-in-out;
body.-modal-open & {
opacity: 1;
}
}
這是因爲'&.-模態打開{overflow:hidden;}'。通過評論來檢查! – Pugazh
這會給我兩個滾動條。我無法從主體中刪除'overflow:hidden;',因爲它也允許在移動設備上滾動(基本上,您無法滾動模式)。 – Microcipcip