0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00
ghost/core/client/app/views/paginated-scroll-box.js
Jason Williams 78361c25af Fix up editor/preview scroll and post list loading
Refs #5381
- Invoke this._super() so mixed in lifecycle hooks run.
2015-06-22 11:35:17 -05:00

31 lines
826 B
JavaScript

import Ember from 'ember';
import setScrollClassName from 'ghost/utils/set-scroll-classname';
import PaginationViewMixin from 'ghost/mixins/pagination-view-infinite-scroll';
var PaginatedScrollBox = Ember.View.extend(PaginationViewMixin, {
/**
* attach the scroll class handler event
*/
attachScrollClassHandler: function () {
var el = this.$();
el.on('scroll', Ember.run.bind(el, setScrollClassName, {
target: el.closest('.content-list'),
offset: 10
}));
},
didInsertElement: function () {
this._super();
this.attachScrollClassHandler();
},
willDestroyElement: function () {
this._super();
// removes scroll class handler event
this.$().off('scroll');
}
});
export default PaginatedScrollBox;