[英]Opening up my side drawer causes a header with fixed position to move when the page is scrolled
這是我的小提琴
我body
有兩個div
元素#drawer
和#content
。 在div #content
內部是一個position: fixed
為header
position: fixed
。
單擊標題中的左上方菜單按鈕時,將使用css3轉換和轉換來轉換主#content
div,以模擬抽屜的“打開”狀態。 當我這樣做時,就會出現問題。
在#drawer
打開的同時滾動#content
div,或稍微滾動此div,然后打開#drawer
,即使header
已#drawer
, header
#drawer
向上移動到頁面頂部。
不確定在凝視了一下問題后出了什么問題時,我希望能有更多有經驗的眼神,因為我試圖盡快完成它。
非常感謝你們能為我提供的任何幫助。 提前致謝 :)
使用transform和position:fixed在一起時遇到了問題。 在我的小提琴中,我使用過渡而不是轉換 。 我還稍稍修改了jQuery,但我想您會明白的。
關鍵是這樣的:
#content.open,
#content.open header{
left: 70%;
}
#content, header {
transition: 300ms left;
-webkit-transition: 300ms left;
-moz-transition: 300ms left;
-o-transition: 300ms left;
left: 0;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.