Giter Club home page Giter Club logo

Comments (6)

michalsnik avatar michalsnik commented on June 6, 2024

Hi again @nathanaelphilip. refresh is a pretty light function - it only check position of elements that were found during initialization. And it's called whenever aos element is being injected to DOM because of the DOM observer implementation.

Ouch.. Now I see what I did wrong there. I should add another method, for example hardRefresh - which will not only recalculate and check positions of elements, but also mutate the store with those elements by pushing new items.

I'm definitely going to make it work.

For now as a quick workaround you can instead of refresh use init with the same options. It should work well I guess ;)

from aos.

nathanaelphilip avatar nathanaelphilip commented on June 6, 2024

sweet! i’ll try that for now. thanks :). this plugin is really nice and i think will replace my own custom way (once all the bugs are worked out).

from aos.

michalsnik avatar michalsnik commented on June 6, 2024

Glad to hear that :) Stay tuned

from aos.

ErtugKaya avatar ErtugKaya commented on June 6, 2024

I'd add a parameter to refresh instead of introducing a new method. For instance refresh(checkDOMs) will reduce confusion.

If you want to go further, there is an API called MutationObserver for detecting DOM changes. Maybe you can hook it and do an auto refresh when a DOM is added or hook it, flag when a change is detected and recheck DOMs only when refresh is called manually. By this you will have an intelligent method that knows if to check DOMs or not. Putting an auto refresh when DOM change in the options will complete this.

Check this out: http://stackoverflow.com/questions/3219758/detect-changes-in-the-dom

from aos.

michalsnik avatar michalsnik commented on June 6, 2024

MutationObserver is actually implemented @ErtugKaya ;) I use it to detect DOM changes and trigger reload. But I spot an issue after @nathanaelphilip message that reload is not checking position of new elements, only the initial ones. I'm going to fix this soon.

I'd rather avoid messing with parameters. Another private method that prepares fresh store with elements and reuses actual reload would be IMHO the cleanest and proper solution.

I'll let you know when it's done in this topic.

from aos.

michalsnik avatar michalsnik commented on June 6, 2024

Hi, I just fixed this issue in #24 .
Version 1.2.2 works like expected.
Now whenever you load some items using ajax they automatically animate and behave properly.

Hope you find this useful :)

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.