- flex空間分配
flex: flex-grow flex-shrink flex-basis本練習運用flex:1(1 1 0%)以進行五等分
以及flex:5 別人是1的話,自己就是佔比5倍
2. transitionend事件:CSS transition結束後發生 *MDN
自己設計時沒想那麼多,直接在open時加入屬性click 時觸發:
.panel.open { font-size: 40px;}
.panel.open>*:first-child {transform: translateY(0%)}
.panel.open>*:last-child {transform: translateY(0%)}_____而Wes Bob則新增open--active的class,如此效果更有層次與範例才會一致click 時觸發:
.panel.open { font-size: 40px;}transitionend 時觸發:
.panel.open--active>*:first-child {transform: translateY(0%)}
.panel.open--active>*:last-child {transform: translateY(0%)}
3. This的運用:eventListener
此處的this指的是被綁定的doms,用this書寫讓程式碼簡潔function toggleOpen() {
this.classList.toggle(‘open’)
}
4. e.propertyName查看transition動畫的屬性
.panel.open {
font-size: 40px;
flex: 5
}用e.propertyName查看會顯示
*之前 JS30 Day1 也有運用到e.propertyName