During implementation I found that when using animateScroll I was only able to invoke the end event and not the begin event as described in the documentation. Looking through the repo I found the following results:
Currently there is no implementation to invoke the 'begin' event within animateTopScroll
We can see that scroller invokes the begin event and also makes a call to animateTopScroll
if(events.registered.begin) {
events.registered.begin(to, target);
}
props.absolute = true;
let scrollOffset = utils.scrollOffset(containerElement, target) + (props.offset || 0);
/*
* if animate is not provided just scroll into the view
*/
if(!props.smooth) {
if (containerElement === document) {
window.scrollTo(0, scrollOffset);
} else {
containerElement.scrollTop = scrollOffset;
}
if(events.registered['end']) {
events.registered['end'](to, target);
}
return;
}
/*
* Animate scrolling
*/
animateScroll.animateTopScroll(scrollOffset, props, to, target);
If we move the call to begin into animateTopScroll as well as into the the if(!props.smooth) block, we can ensure this event is always called when set by devs.
During implementation I found that when using
animateScroll
I was only able to invoke theend
event and not thebegin
event as described in the documentation. Looking through the repo I found the following results:Currently there is no implementation to invoke the 'begin' event within
animateTopScroll
We can see that
scroller
invokes thebegin
event and also makes a call toanimateTopScroll
If we move the call to
begin
intoanimateTopScroll
as well as into the theif(!props.smooth)
block, we can ensure this event is always called when set by devs.