davetayls/jquery.kinetic

Make the listeners return current scroll positions.

Closed this issue · 3 comments

I propose implementing a system where the listeners for moved and stopped return the current scroll position.

Can probably by realised by changing Kinetic.prototype.stop and change the line this.settings.stopped.call(this); to this.settings.stopped.call(this,settings,{left: this.scrollLeft(),top: this.scrollTop());

According to the current documentation the stopped function also returns the settings, which it doesn't. It does work as documented in the moved function. This is fixed in the above mentioned change.

Should also be changed in Kinetic.prototype._move. Change settings.moved.call(this, settings); to this.settings.moved.call(this,settings,{left: this.scrollLeft(),top: this.scrollTop());

this isn't really needed anymore since you can just access the current instance within the moved function ie:

moved: function() { console.log(this.scrollLeft()); }

good spot that the docs are outdated though

Alright, didn't know that I could access the instance from inside the callback. Good call, thanks!

no worries, i've updated the docs 😄