classes `aos-animate` not being applied (NextJs)
See original GitHub issueI’m working with NextJs and the aos-init
classes on my elements are applied and only the elements in view on load are properly animated. The rest of my elements do not get the aos-animate
class applied on scroll. There seems to be some kind of interference with the scroll listeners. Help!
This is:
- Bug
Specifications
- AOS version:
- OS: MacOS
- Browser: Chrome
Expected Behavior
aos-animate
class being applied on scroll
Actual Behavior
aos-animate
class not being applied on scroll. Only on load on elements in the viewport.
Steps to Reproduce the Problem
N/A
Detailed Description
aos-init
classes are being appliedaos-animate
classes are only being applied on load to the elements in the viewportaos-animate
classes are not being applied on scroll
One solution I’ve tried so far is manually adding an event listener and triggering AOS.refresh()
but the animation isn’t smooth and does not work as well as how it should behave (also a very sketchy patch)
useEffect(() => {
AOS.init({
duration: 700,
delay: 50,
once: true,
})
window.addEventListener('touchmove', () => {
AOS.refresh()
}, false)
})
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
Developers - classes `aos-animate` not being applied (NextJs) -
I'm working with NextJs and the aos-init classes on my elements are applied and only the elements in view on load are properly...
Read more >Button disappering in next js due to data-aos-animation
my button are disappearing onclick due to data-aos-animation. on removing data-aos-animation everything is fine. but I want these animations ...
Read more >How to Add Interactive Animations and Page Transitions to a ...
Step 0: Installing Framer Motion in your Next.js app. Since we're going to use Framer Motion to provide our animation features, the first...
Read more >Next Js + AOS Library, Content in the viewport is not animating.
Aos is not triggering the animation of the first div or section in the viewport. For Eg: if I visit the website, sometimes...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Check my repo “Aos-implementation”, check how I configured _app.js and how I am using aos in the sectionOne.js for example (In the component folder) for example. Working out of the box on Safari, Chrome, Firefox, DuckDuckGo.
Here you can have a quick look to see that it’s working, and animation gets reset every time you scroll back up :
aos-implementation-git-main.egamopi.vercel.app
Do we have any fix for this issue? anyone’s reply will be helpful. Thank you!