Skip to content

Commit

Permalink
Merge pull request #129 from pertrai1/issue-124
Browse files Browse the repository at this point in the history
#124 - Add ability to hide menu when clicking outside of menu
  • Loading branch information
DaleMcGrew committed Mar 13, 2016
2 parents c1f7099 + 23a8aa4 commit 71a95d6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/js/components/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ export default class Header extends Component {
this.state = {
visible: false
};
}
};

componentDidMount () {
this._onChange();
this.listener = VoterStore.addChangeListener(this._onChange.bind(this));
document.body.addEventListener("click", this.pageClick.bind(this), false);
}

componentWillUnmount (){
Expand All @@ -35,6 +36,11 @@ export default class Header extends Component {
})
}

pageClick () {
this.hide();
}


show () {
var mainContainer = document.querySelector(".container-main");
if (this.state.visible) {
Expand Down

0 comments on commit 71a95d6

Please sign in to comment.