Giter Club home page Giter Club logo

Comments (36)

michalsnik avatar michalsnik commented on May 27, 2024 13

I've got a working prototype and I wonder what do you think guys about customEvents?
Every element while animating in or out would trigger aos:in or aos:out event, that you can listen to on document.

Also you'd be able to provide data-aos-id in order to trigger unique event:

<div data-aos="fade-in" data-aos-id="super-duper"></div>

It would trigger aos:in:super-duper and aos:out:super-duper accordingly.

Example usage:

document.addEventListener('aos:in:super-duper', ({ detail }) => {
  console.log('in!', detail);
});

details would be DOM Node that have been animated, so if you'd want to pass additional data, you could just use data-attributes and access them here: detail.getAttribute(...).

This is my proposal, but I'm open for suggestions. So feel free to share your ideas :)

from aos.

michalsnik avatar michalsnik commented on May 27, 2024 9

Hi, for now it's unfortunately not possible.
But it sound like something worth considering as a new feature.
I'd be happy to see if some other people would also appreciate it in future releases :)

from aos.

influxweb avatar influxweb commented on May 27, 2024 6

Having the ability to fire a callback either during or after animation would be a great addition. I can see it being used as a way to display a section when scrolled into view; then firing the callback to lazy-load an image contained in the section.

from aos.

Scordavis avatar Scordavis commented on May 27, 2024 6

Давай! Сделай эту приблуду! )))

from aos.

michalsnik avatar michalsnik commented on May 27, 2024 5

Hi @ErtugKaya , reanimating can actually be easily disabled using aos-once setting.

But I like your idea with different hooks that user can set on certain elements and which will be fired in specific moment. This sounds like an interesting feature to me :)

I'd be happy to see if this would be useful for other developers as well. I'm open for any suggestions :)

from aos.

ErtugKaya avatar ErtugKaya commented on May 27, 2024

I think events will be very useful and make this great plugin even greater. Maybe one trigger before the animation begins to prevent or change animation for some reason and another triggers after the animation begins to remove animation or do anything else.

For instance; I don't like items re-animate while scrolling to top and bottom again. With an event, i can easily remove animations after each item animates individually.

from aos.

fehmi avatar fehmi commented on May 27, 2024

+1

from aos.

LucaRosaldi avatar LucaRosaldi commented on May 27, 2024

+1

from aos.

andresmgsl avatar andresmgsl commented on May 27, 2024

+1 it would indeed be a very useful functionality... I'm a Front-End Angular developer, and in my case, I would be able to get data from the server while scrolling, improving UI experience.

from aos.

tomByrer avatar tomByrer commented on May 27, 2024

-1 for main repo; 1/2 of the point of this project vs the 10 other scroll-animation libs is the CSS animation
+1 If Felix or someone wants to have a 'friendly fork'.

from aos.

bih avatar bih commented on May 27, 2024

+1 for this feature.

from aos.

drawcard avatar drawcard commented on May 27, 2024

+1

from aos.

andresmgsl avatar andresmgsl commented on May 27, 2024

+1

from aos.

brianbento avatar brianbento commented on May 27, 2024

+1

from aos.

rutgerikoon avatar rutgerikoon commented on May 27, 2024

Added my vote, would make this library even more useful

from aos.

hungluu avatar hungluu commented on May 27, 2024

+1

from aos.

mishalmsb avatar mishalmsb commented on May 27, 2024

+1

from aos.

RadiksMan avatar RadiksMan commented on May 27, 2024

+1

from aos.

diegohdk avatar diegohdk commented on May 27, 2024

+1

from aos.

husani avatar husani commented on May 27, 2024

+1

from aos.

Kwapi avatar Kwapi commented on May 27, 2024

+1

from aos.

donnellyjoe avatar donnellyjoe commented on May 27, 2024

+1, would be great to have a JS animation option for something where CSS isn't enough, such as counting up numbers, or a webgl animation

from aos.

torsteinringnes avatar torsteinringnes commented on May 27, 2024

+1

from aos.

npstobie avatar npstobie commented on May 27, 2024

+1

from aos.

anaparunov avatar anaparunov commented on May 27, 2024

+1

from aos.

brynzovskii avatar brynzovskii commented on May 27, 2024

+1

from aos.

illycz avatar illycz commented on May 27, 2024

+1

from aos.

withlovee avatar withlovee commented on May 27, 2024

+1

from aos.

StevenLewis avatar StevenLewis commented on May 27, 2024

+1

from aos.

michalsnik avatar michalsnik commented on May 27, 2024

I just released v3.0.0-beta.1, you play with it by installing:

yarn add aos@next

from aos.

anithegregorian avatar anithegregorian commented on May 27, 2024

Hey @michalsnik ,

Don't know if this is a bug but when you set data-aos-duration="900" data-aos-offset="0" data-aos-once="true" data-aos-delay="1200" attributes the events aos:in or aos:out don't get fired at all.

See this JS fiddle https://jsfiddle.net/anithegregorian/w0s4xmc0/29854/

If you remove these attributes and resize result iframe it starts working normally. Im using next branch beta4 release.

from aos.

nadafsak avatar nadafsak commented on May 27, 2024

Hi @michalsnik similar to what @anithegregorian said, the event listener does not seem to be working.

However, for me - it does not matter what additional attributes have been added.

Even on @anithegregorian 's JSfiddle, removing the additional properties still doesn't fire the event and when I use [email protected] locally.

from aos.

Harti avatar Harti commented on May 27, 2024

I stumbled across this issue while I was looking for an event being fired when an element simply fulfills the AOS anchor requirements.

Use case:

  • I need "scrollspy"-like functionality for a project. I don't want to use bloated/cluttered/unflexible third-party software, especially when AOS already runs exactly those element visibility checks. I don't want any prepared markup nor auto-highlighting, I just need a mere event telling me that the element arrived at the anchor.
  • I do not want to have to animate those nodes for this event to be fired.

Would this be feasible?

from aos.

lsterling03 avatar lsterling03 commented on May 27, 2024

Just wanted to thank you for this. The event listener @michalsnik proposed works great for me.

from aos.

otlyn avatar otlyn commented on May 27, 2024

Hi, thank you for the awesome plugin. I was wondering if you could make a working JS Event example on codepen.io to fire a console log or something. I've tried it myself, but I'm having difficulty. Thanks in advance!

from aos.

michalsnik avatar michalsnik commented on May 27, 2024

@otlyn Thanks! Please make sure you use aos@next and follow this comment: #17 (comment)

from aos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.