aos
aos copied to clipboard
Duration of 0 set through data attributes gets default behavior
This is:
- Bug
Specifications
- AOS version:
- OS: MacOS 12.3.1
- Browser: Safari 15.4, Vivaldi 5.3.2679.70, and couple of Chrome browsers but don't know specific versions
Expected Behavior
When animation duration is set to 0, animation should happen immediately
Actual Behavior
When animation duration is set to 0, appears to revert to whatever default was set (250ms?)
Steps to Reproduce the Problem
- on an element, set data-aos-duration="0"
- Run AOS.init()
- Observe that it animates with the default duration
- (workaround) Run AOS.init({duration: 0})
- Observe that it behaves as expected
Detailed Description
My guess is that the code is doing a boolean check to see whether or not a value is set - and a value of 0 comes up as false. Probably just needs to do a more detailed check? (Apologies, I'm under a deadline and just don't have the time to trace through code and validate my hypothesis.)
Possible Solution
Hopefully it's as easy as checking for the presence of a non-false 0 value.