From 968b640fc289a3b01d2848ef461972c07077af90 Mon Sep 17 00:00:00 2001 From: sorrycc Date: Tue, 4 Aug 2015 15:03:00 +0800 Subject: [PATCH] add resize event for affix --- components/affix/index.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/affix/index.jsx b/components/affix/index.jsx index ed6fdd5b02..02b60d4cf3 100644 --- a/components/affix/index.jsx +++ b/components/affix/index.jsx @@ -72,12 +72,16 @@ var Affix = React.createClass({ componentDidMount() { this.scrollEvent = rcUtil.Dom.addEventListener(window, 'scroll', this.handleScroll); + this.resizeEvent = rcUtil.Dom.addEventListener(window, 'resize', this.handleScroll); }, componentWillUnmount() { if (this.scrollEvent) { this.scrollEvent.remove(); } + if (this.resizeEvent) { + this.resizeEvent.remove(); + } }, render() { @@ -96,4 +100,3 @@ var Affix = React.createClass({ }); module.exports = Affix; -