michalsnik / aos

Animate on scroll library
MIT License
26.55k stars 2.57k forks source link

Caching issue? #373

Open harrymerci opened 6 years ago

harrymerci commented 6 years ago

This is:

Specifications

Expected Behavior

Animation to work

Actual Behavior

The animation works in Incognito, but not normal browser. Why is this?

Steps to Reproduce the Problem

http://en.wearemerci.com

I have this script added in :

Is this the correct way to this?

simmonsr commented 6 years ago

Viewing your site it works fine in both normal / incognito. Are you still experiencing issues?

michalsnik commented 6 years ago

There's no cache here @harrymerci It looks like AOS is recalculating position of its' elements too early before your page repaints all elements. You might want to add extra resize event listener with bigger value on debounce. The original code that handles this scenario can be found here: https://github.com/michalsnik/aos/blob/next/src/js/aos.js#L193

harrymerci commented 6 years ago

I don't understand, sorry.

The animation of elements when scrolling doesn't happen if re-visit the same page.

Can you explain what I need to do? Thanks

michalsnik commented 5 years ago

You can try to add:

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

Also you don't need the refreshHard.

akashpatelj93 commented 3 years ago

I am facing the same issue. Did we find fix for this? Above doesn't seems to be working. Please assist me with this.