Ghost/core/client/app/views/paginated-scroll-box.js

28 lines
778 B
JavaScript
Raw Normal View History

2015-02-13 07:22:32 +03:00
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.attachScrollClassHandler();
},
willDestroyElement: function () {
// removes scroll class handler event
this.$().off('scroll');
}
});
export default PaginatedScrollBox;