Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Listening for elements added to DOM #34

Open
intelligence opened this issue Oct 13, 2014 · 4 comments
Open

Listening for elements added to DOM #34

intelligence opened this issue Oct 13, 2014 · 4 comments

Comments

@intelligence
Copy link

I'm loading stuff dynamically on a site, and noticed that inview doesn't trigger for stuff that's been added after the bind is initialized. Should I just trigger it again? I imagine there will be double binds then and possibly more strain on the CPU?

@decadence
Copy link

Try $(document).on('inview', '.my_elements', function (){});

@cssagogo
Copy link

This works to some degree, but not on elements that are updated asynchronously that appear in view from the start. I have to scroll the element out if view and back again for it to work. It is as if the the initial check to see if an item is in view does not fire when you rebind after the initial load of the Dom.

@brittonk
Copy link

brittonk commented Aug 4, 2018

If anyone comes upon this old post,
To get it to work correctly with items added to the dom, I also use livequery...
(don't forget to load livequery)

then change .on to .livequery for listening on appended items.
$(document).livequery('inview'...

@fleurdulicoder
Copy link

I am doing animation on inview, and it is dynamically added images that float upward. I cannot use inview delegation here on the parent, what happens is the parent attaches all the animations immediately to all children that got appended and animation simply for children does not work in view... The whole idea gets lost. How do I delegate inview event correctly, so that the children inview animate each, not the parent animating all of them simultaneously?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants