diff options
author | Christopher Speller <crspeller@gmail.com> | 2015-09-25 12:17:38 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2015-09-25 12:30:36 -0400 |
commit | 425797eb3825b4d9f76302512bc60c552180d6fe (patch) | |
tree | a684992677506f7c8b0c3b44aa239e9ed6bbe145 /web | |
parent | 5b3cc2a4e7891e0f9786444b9f001e7098896713 (diff) | |
download | chat-425797eb3825b4d9f76302512bc60c552180d6fe.tar.gz chat-425797eb3825b4d9f76302512bc60c552180d6fe.tar.bz2 chat-425797eb3825b4d9f76302512bc60c552180d6fe.zip |
Partial fix to scrolling issues. No longer jumps up from the bottom when RHS opens
Diffstat (limited to 'web')
-rw-r--r-- | web/react/components/post_list.jsx | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/web/react/components/post_list.jsx b/web/react/components/post_list.jsx index 218922b67..3e1e075bb 100644 --- a/web/react/components/post_list.jsx +++ b/web/react/components/post_list.jsx @@ -105,18 +105,18 @@ export default class PostList extends React.Component { UserStore.addStatusesChangeListener(this.onTimeChange); SocketStore.addChangeListener(this.onSocketChange); - var postHolder = $(React.findDOMNode(this.refs.postlist)); + const postHolder = $(React.findDOMNode(this.refs.postlist)); - $(window).on('resize.' + this.props.channelId, function resize() { + $(window).resize(() => { this.resize(); if (!this.scrolled) { this.scrollToBottom(); } - }.bind(this)); + }); - postHolder.on('scroll', function scroll() { - var position = postHolder.scrollTop() + postHolder.height() + 14; - var bottom = postHolder[0].scrollHeight; + postHolder.on('scroll', () => { + const position = postHolder.scrollTop() + postHolder.height() + 14; + const bottom = postHolder[0].scrollHeight; if (position >= bottom) { this.scrolled = false; @@ -128,7 +128,7 @@ export default class PostList extends React.Component { this.userHasSeenNew = true; } this.isUserScroll = true; - }.bind(this)); + }); $('.post-list__content div .post').removeClass('post--last'); $('.post-list__content div:last-child .post').addClass('post--last'); @@ -146,7 +146,7 @@ export default class PostList extends React.Component { UserStore.removeStatusesChangeListener(this.onTimeChange); SocketStore.removeChangeListener(this.onSocketChange); $('body').off('click.userpopover'); - $(window).off('resize.' + this.props.channelId); + $(window).off('resize'); var postHolder = $(React.findDOMNode(this.refs.postlist)); postHolder.off('scroll'); } |