This is a real-life scenario when AOS animations library simply stopped working in my WordPress theme.
I normally prefer to keep a website’s HTML and WordPress theme separate and once the HTML is done, then shift the code into a WordPress theme.
Following my normal procedure when I added the first few lines of code for the header in WordPress and loaded the page, the AOS animations were not working but it was working in my HTML template.
I thought to myself there goes my few hours of debugging this issue as I have tried most of the debugging steps that I could think of at that moment.
If you are facing the same issue with a blank WordPress Theme or you are developing a theme based upon the latest WordPress theme.
Then look for the class “no-js” on the <body>
opening tag and remove the “no-js” class.
If you do not see a “no-js” class in the PHP file then look at the source code in the browser to see if somehow a plugin is adding that class to the <body>
or <html>
tag.
The above solution worked instantly for me and saved me a lot of time debugging.
Hope this helps someone else too, if not you can look for other solutions online or create an issue on AOS GitHub page.
Let me know your thoughts or questions in the comments section below.