Closed BrendanNeufeld closed 9 years ago
I think you could add it here: https://github.com/Jam3/scroll-manager/blob/master/index.js#L51
Something like:
if (elapsedTime < duration) {
setTimeout(function() {
animateScroll(elapsedTime);
}.bind(this), increment);
}else{
if(callback) callback();
}
Thanks for the suggestion @BrendanNeufeld added in 1.1.0 :)
so something like:
scoller.scrollTo(element, offsetToScroll, duration, ease, callback);
You may want to format the
scrollTo
function to accept an options object and a callback function so you don't have to check for optional params. So something like:This is up to you. But this format is pretty common and is easier to check for optional options and a callback.