michalsnik / aos

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

aos event listener ignore data-aos-delay #385

Open thiscodeworks opened 6 years ago

thiscodeworks commented 6 years ago

This is:

Specifications

Expected Behavior

Event trigger should count with settings in data-aos-delay or there should be option, now you need to call something like

document.addEventListener('aos:in:number', ({ detail }) => { var timeout = $(detail).attr("data-aos-delay"); setTimeout(function() { console.log('animated in', detail); }, timeout); });

Actual Behavior

Event is triggered without delay that cause Javascript code is running before actual animation happend - element is not showed but javascript thing is already happend

michalsnik commented 5 years ago

Good catch @thiscodeworks !

thiscodeworks commented 5 years ago

Np, btw the lister have problem in IE11 .. I rewrite it to basic jqurey $(document).on('aos:in:number', function(ev) { var element = ev.detail; });