Re: CSS events

On Mon, Dec 14, 2015 at 4:04 PM, Nicolas Duclos <dunic777@hotmail.com> wrote:
> 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>.

This is difficult to do well in CSS, for the reasons I outline in
<https://tabatkins.github.io/specs/css-toggle-states/#checked-problems>.

You might want to look up the "checkbox hack"
<https://css-tricks.com/the-checkbox-hack/>, as it gives you similar
abilities without JS.  It just requires some additional HTML to
support it.

~TJ

Received on Wednesday, 16 December 2015 18:37:06 UTC