transition 與 不固定高度模塊 實現過渡
transtion與不固定高度實現過渡
只需要這隻max-Height就可以
如下react代碼
<div className={`skuListBox ${this.state.hover?'maxHeight800':'maxHeight0'}`} onMouseEnter={this.mouseEnter.bind(this)} onMouseLeave={this.mouseLeave.bind(this)}>
高度變化
</div>
// onMouseEnter/onMouseLeave 方法用來改變hover的值
onMouseEnter = () => {
this.setState({hover:true});
};
onMouseLeave = () => {
this.setState({hover:false});
};
.maxHeight800{
max-height: 800px!important;
}
.maxHeight0{
max-height: 0!important;
}