egidiusmengelberg / nuxt-aos

A Nuxt module that adds Animate On Scroll
https://www.npmjs.com/package/nuxt-aos
MIT License
65 stars 5 forks source link

How can I ban animation globally? #14

Open champ7champ opened 8 months ago

champ7champ commented 8 months ago

I want if the client has already visited the page, then it is this page that he no longer animated and those that he did not visit animated.

egidiusmengelberg commented 8 months ago

You might be able to figure something out using the docs from the aos package this plugin uses: https://github.com/michalsnik/aos

Maybe the disabled key can be useful, you probably need to refresh the aos plugin after changing its config.

BayBreezy commented 7 months ago

Hey @champ7champ , There is an option for the animation to run once per page visit.

If I am not mistaken, I think you want the animation to run once per website visit. So if the user goes to the home page, all the animations should play once and then if they go to another page and come back to the home page, you don't want the animation to run again, correct? if yes, then sadly, that would require some additional work to store the animated state in localstorage or something(based on the pages that have already been visited)

Based on the docs here: https://github.com/michalsnik/aos?tab=readme-ov-file#1-initialize-aos, the once option causes the elements to animate once per page visit but not once for the entire website visit. So once they leave the page and come back, the animation will run again. Let me know if that makes sense.