CSS events

Hi,

I have some suggestions to improve CSS in the futur. For me CSS is much easier to understand than Javascript adn can work even if Javascript is disabled. I though about two kind of events :

Click event :

Could allow to make dropdown menu (mobile) or sub-menu animation. Could also allow to modify Something on the page itself.

Example :

.class :click{
 Color : blue;
}

So this could allow us to change the font color to blue if you click on this class, span, etc. Could also work with a navigation like if you click on this item, it will open it and you could add the normal transition. Also could be great to make some kind of Spoiler tag. <spoiler>.
Or if you want to make a button that make the background change and return to normal after another click :

.button :click :return{

Body{
 Background : url(whatever.jpg);
}

}

So there is a possibility to put more Inside {} Also :return mean that if you re-click on this, it will change back.

Scroll event :

On some website, you can see a navigation bar that become fixed after you scroll down a certain height. With this new CSS option, it could be possible only with CSS instead of Javascript (AFFIX, etc.). 

Example :


nav {
 position : relative;
}
nav :scroll-down(1vh){
 position : fixed;
 top : 0px;
}

So that mean that the navigation is relative and when the screen scrolldown 1vh, the nav is now fixed on top of the screen. You can also use scroll-up/left/right.


Thank you very much.

Nicolas D.

Received on Tuesday, 15 December 2015 10:46:33 UTC