Skip to content

Instantly share code, notes, and snippets.

@samselikoff
Created October 27, 2016 15:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samselikoff/6408fb1bf148d6a628125b6ab9a93a77 to your computer and use it in GitHub Desktop.
Save samselikoff/6408fb1bf148d6a628125b6ab9a93a77 to your computer and use it in GitHub Desktop.
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