question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

classes `aos-animate` not being applied (NextJs)

See original GitHub issue

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 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 applied
  • aos-animate classes are only being applied on load to the elements in the viewport
  • aos-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:open
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

9reactions
EgamoPicommented, Nov 11, 2020

Same issue

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

1reaction
yogesh-bitontreecommented, Jun 30, 2022

Do we have any fix for this issue? anyone’s reply will be helpful. Thank you!

Read more comments on GitHub >

github_iconTop 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 >
AOS - Animate on scroll library
AOS - Animate On Scroll library using CSS3.
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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found