Animation working directly
Animation works only when I open the dev console (I think it's because it's SSR)
Having same issues.
It only works on dev environment and doesn't display anything in production
How did you guys get it to work (even in dev) with NextJs?
I get the initial load animation, but nothing happens on scroll. When i inspect my elements, the aos-init class is added, but aos-animate isn't being added on scroll.
How did you guys get it to work (even in dev) with NextJs?
I get the initial load animation, but nothing happens on scroll. When i inspect my elements, the
aos-initclass is added, butaos-animateisn't being added on scroll.
When page is loaded, just open the devtools and close it. It should make the scroll work.
Where and when are you initializing aos? Try initializing aos in an effect in _app.js.
Up!
Hi guys, I am also trying to integrate AOS with next js.
-J
adding something like this in pages/_app.js works for me:
import { useEffect } from "react";
import AOS from "aos";
import "aos/dist/aos.css";
import "../scss/style.scss";
function MyApp({ Component, pageProps }) {
useEffect(() => {
AOS.init({
easing: "ease-out-cubic",
once: true,
offset: 50,
});
}, []);
return <Component {...pageProps} />;
}
export default MyApp;
@knowbody I'll try to implement it tomorrow and I will let you know how it goes. Does is also work in production ?
@knowbody thank you, works perfectly. I think we can close this issue.
Most helpful comment
adding something like this in
pages/_app.jsworks for me: