michalsnik / aos

Animate on scroll library
MIT License
26.74k stars 2.58k forks source link

Scroll to anchor and aos problem. #478

Open berpcor opened 5 years ago

berpcor commented 5 years ago

Hello. I use dot navigation with navigation to anchors on the page. For aos I use mirror:true option. So that elements hide each time they are out of viewport. Here starts the problem. When I click navigation dot (for to navigate to element which is out of viewport now), I scroll to element, but as it appears with delay, top offset equals to current position of element, and he is not on its final place yet. So dot navigates me to the wrong position, then when element is on its final place (aos finished animation) I click the same dot second time and now it navigates me correct to the real top of element. Did you consider it when you created plugin? How can I get final position of element to navigate to it?

blacktxandy commented 5 years ago

I'm having the same issue using Vue&Vuetify: using scrollTo(element) scrolls to the element, but then, all the content in between the path of scrolling is animated and the final height of the elements have changed. It ends up scrolling to a random position (depending on how quick the elements in the path have been animated). Maybe there could be an option to create a placeholder the same height of the animated element, just to keep the page height the same.