michalsnik / aos

Animate on scroll library
MIT License
26.82k stars 2.6k forks source link

Graceful fallback when JavaScript not available #541

Open adrianth opened 4 years ago

adrianth commented 4 years ago

Would it be possible to make it so that, when JavaScript is not available, the elements are shown as they would normally be if no animation was applied to them? If possible to add without introducing a breaking change, I believe it would be a very welcome improvement. We take JavaScript for granted today, but I also know people that keep it disabled by default and only enable it for trusted domains.

magicalbrad commented 4 years ago

FWIW, here's how I'm handling noJS. My site uses the convention of setting "js" or "no-js" on the html root. I use the following css to make sure everything shows without JS:

html.no-js [data-aos] { opacity: 1; transform: none; }

The "html" tag is explicitly referenced to provide sufficient specificity to override the default properties. You could need to override other properties for some animations, but this works for the ones I'm using.