Skip to content

Commit 0622d08

Browse files
bobpacemtscout6
authored andcommitted
added ability to set container for fade mixin rather than hard code to append a div to document.body
1 parent 0c763b4 commit 0622d08

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/FadeMixin.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@ module.exports = {
4141
},
4242

4343
componentWillUnmount: function () {
44-
var els = this.getDOMNode().querySelectorAll('.fade');
44+
var els = this.getDOMNode().querySelectorAll('.fade'),
45+
container = (this.props.container && this.props.container.getDOMNode()) || document.body;
4546
if (els.length) {
4647
this._fadeOutEl = document.createElement('div');
47-
document.body.appendChild(this._fadeOutEl);
48+
container.appendChild(this._fadeOutEl);
4849
this._fadeOutEl.appendChild(this.getDOMNode().cloneNode(true));
4950
// Firefox needs delay for transition to be triggered
5051
setTimeout(this._fadeOut, 20);

0 commit comments

Comments
 (0)