Created
October 27, 2016 15:14
-
-
Save samselikoff/6408fb1bf148d6a628125b6ab9a93a77 to your computer and use it in GitHub Desktop.
This file contains 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
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
willUpdate() { | |
this._super(...arguments); | |
let box = this.$('ul')[0]; | |
let isScrolledToBottom = box.scrollTop + box.clientHeight === box.scrollHeight; | |
this.set('isScrolledToBottom', isScrolledToBottom); | |
}, | |
didRender() { | |
this._super(...arguments); | |
if (this.get('isScrolledToBottom')) { | |
this.$('ul')[0].scrollTop = this.$('ul')[0].scrollHeight; | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment