Skip to content

Commit

Permalink
get position before debounce step
Browse files Browse the repository at this point in the history
  • Loading branch information
bttf committed Aug 19, 2016
1 parent e4c92f1 commit 8dfbf2c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions addon/mixins/scroll-operator.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ export default Ember.Mixin.create({

_attachEvents() {
const onScroll = () => {
Ember.run.debounce(this, this._setScrollTop, this._scrollingTimeout);
const scrollPosition = Ember.$(window).scrollTop();
Ember.run.debounce(this, this._setScrollTop, scrollPosition, this._scrollingTimeout);
};
Ember.$(document).on('touchmove.scrollable', onScroll);
Ember.$(window).on('scroll.scrollable', onScroll);
Expand All @@ -73,8 +74,8 @@ export default Ember.Mixin.create({
/**
* Set currentPosition to $(window).scrollTop value.
*/
_setScrollTop() {
this.set('controller.currentPosition', Ember.$(window).scrollTop());
_setScrollTop(scrollPosition = 0) {
this.set('controller.currentPosition', scrollPosition);
},

/**
Expand Down

0 comments on commit 8dfbf2c

Please sign in to comment.