2016-07-14 225 views
-1

我正在試圖製作一個簡單的右側欄,它應該從右側onclick淡入淡出。下面是從左側出現的側邊欄示例:JsfiddlecodeReact js右側欄:從右側淡入淡出

任何線索?我對CSS的瞭解; HTML和反應JS是基本的。所以任何幫助或建議將不勝感激。

+0

所有問題都必須包括在問題本身的代碼,而不是在另一個網站上。 –

回答

0

我已經更新了搗鼓你:

https://jsfiddle.net/cc96ku6t/3/

你需要改變leftright基本上在CSS:

header { 
    position: absolute; 
    top: 0; 
    left: 0; 
    right: 0; 
    height: 60px; 
    background-color: lightcoral; 
} 
.sidebar { 
    position: absolute; 
    top: 60px; 
    right: -300px; 
    height: 100%; 
    width: 300px; 
    transition: left .3s ease-in-out; 
    background-color: white; 
} 
.sidebar-toggle { 
    position: absolute; 
    top: 20%; 
    left: -60px; 
    height: 60px; 
    width: 60px; 
    z-index: 1; 
} 
.content { 
    position: absolute; 
    top: 60px; 
    left: 0; 
    right: 0; 
    height: 100%; 
    transition: left .3s ease-in-out; 
    background-color: lightgray; 
} 
.sidebar.open { 
    right: 0; 
} 
.content.open { 
    right: 300px; 
} 
+0

但是衰落並不平坦。它剛剛出現。 –

+0

檢查更新版本。我錯過了一個「左」:) – ctrlplusb

+0

酷!謝謝。 –