Add an optional callback to the scrollTo and navigateTo
It would be useful if we had a callback from the scrollTo and navigateTo, as we could, for example, flash an element once it had been scrolled to or update an extension once the element is in view.
This would stop the need in using a delay function to accommodate the navigation time, which can be very unreliable.
~~Have you tried using the below?~~
Adapt.once("page:scrollTo", callback);
~~I use this in one of my extensions to flash an element.~~
EDIT: Sorry, I realise now I don't use the scroll duration.
Thanks @tomgreenfield will give that a go!
Adapt.scrollTo has a onAfter callback for work that runs after the animation finishes.
// Syntax: Adapt.scrollTo(element, options);
Adapt.scrollTo('.a-05', {
onAfter: function() {
console.log('trigger this after page has scrolled');
}
})
@nilssanderson can this be closed?
Yes, thank you to all replies!