creativelive / appear

execute callbacks when dom elements appear in and out of view
http://creativelive.github.io/appear/
MIT License
178 stars 43 forks source link

ability to set target scrollable container #15

Closed celenetinkz closed 6 years ago

celenetinkz commented 6 years ago

is there a way to set the target scrollable container? Eg let say i have a div(#sample) that contains elements (images). div#sample is static in the viewport but it content is scrollable. on scroll in div#sample can appear.js; appear/disappear/reappear/etc functions can be run/use

JustinBeaudry commented 6 years ago

If you look at appearlazy you'll see that it uses the appear library to set a container for elements using data-src and will recursively look through that container for elements with that attribute. You can use appearlazy to do this or you can use it as an example of how to do this yourself.

https://github.com/creativelive/appear/blob/master/lib/appearlazy.js