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

28 lines
778 B
JavaScript
Raw Normal View History

2015-02-12 21:22:32 -07: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;