Aos: Only firing on window resize

Created on 4 Jul 2017  路  4Comments  路  Source: michalsnik/aos

I'm finding I can only get AOS working when I resize the browser, and only with elements that are currently in the viewport. Scrolling to a blank element and it remains blank.

I've tried initiating and using refresh to no avail...

AOS.init();
window.addEventListener('load', AOS.refresh);
question

Most helpful comment

I discovered in my case the content was inside some other divs with overflow: hidden and overflow-y: scroll set. Removing these properties seems to fix the issue.

All 4 comments

Hey @skube, Is it possible that something is expanding content on your page after load event on window? Solution with window.addEventListener('load', AOS.refresh); should usually fix all the issues with elements not animating.

I discovered in my case the content was inside some other divs with overflow: hidden and overflow-y: scroll set. Removing these properties seems to fix the issue.

Finally solved this issue by calling refresh method inside scroll listener on parent container .
For angular, add below code in app.component.ts -> ngOnInit()

$(".parent-container").on('scroll', function () {
      AOS.refresh();
 });

Try using

$(window).on("load", function () {
    AOS.init();
});

what is equvalent to

window.addEventListener('load', AOS.init());

Was this page helpful?
0 / 5 - 0 ratings

Related issues

timotheegoguely picture timotheegoguely  路  3Comments

noisypope picture noisypope  路  4Comments

hockey2112 picture hockey2112  路  4Comments

Panoplos picture Panoplos  路  3Comments

meko-deng picture meko-deng  路  4Comments