I have attempted to come up with an easier way to detect when an HTMLElement enters or exits the viewport. There have been many articles and libraries I’ve seen but none of them (at least to my knowledge) do not address entering, entered, exiting, exited events while providing offsets (to do something before the element actually shows in the viewport).
I’ve started a github project with a class called ElementListener that I would like to use as my proposal, but would love to get your thoughts on implementing something like this in the spec or whether or not you think it is worth it to pursue. To be honest, given that I use a class that should instantiated, I’m actually not even sure how best to implement something like this in the spec, so would love your thoughts on that also.
Thanks for your feedback and constructive criticism.