[selectors] Proposal :enter and :leave

:enter would be an pseudo class to detect when an DOM element will enter 
in the viewport of the browser.

This could happend, when page is loaded, scrolled or resized.

:leave would be the opposite meaning that it will occur when an DOM element will leave the viewport of the browser.

You can find a sample of this behavior by looking at the below library which reproduces this behavior by adding dynamically "enter" and "leave" class on some specific DOM elements.

http://jfroffice.github.io/x-enterleave.js/

That would be handsome and quite useful to design "enter / leave" animation.

This purpose might also be extend to bind the same kind of event according the parent DOM element.
But it will cost maybe more in implementation. (even if overflow css properties look more less like an already implemented algorithm in the browser).

I hope my proposal is quite understandable.

Do not hesitate, for some feedback.

Maybe I missed something and this problematic has been already debated.


- John

Received on Friday, 19 December 2014 13:52:16 UTC