Created
June 8, 2017 17:13
-
-
Save tiagoengel/783a31090646f81254f2401e6c6ce837 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
toggle(e) { | |
e.preventDefault(); | |
let wrapperHeight = this.refs.transitionWrapper.clientHeight; | |
if (this.state.expanded) { | |
this.setState({ expanded: false, submenuHeight: 0 })); | |
} else { | |
this.setState({ | |
expanded: true, | |
submenuHeight: wrapperHeight | |
}); | |
} | |
} | |
<div className="submenu" ref="submenu" style={{ height: submenuHeight }}> | |
<div ref="transitionWrapper"> | |
{childrens} | |
</div> | |
</div> | |
.submenu { | |
@include transition(height, 0.3s, ease-in); | |
height: 0; | |
overflow: hidden; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment