I am thinking of an alternative to JavaScript in case it's manually disabled by the user, so that instead of prompting them to enabled it, I could, for instance, in some way simulate the click event and change, for instance, the background colour by creating my own :click pseudo-class, just like it works for :hover.
Is such a scenario possible? Is it possible for one to create their own css pseudo-classes that?
If your question is, can I create a custom pseudo, example;
div:my-custom-pseudo { }
Then not without some JavaScript libraries.
Tutorial on using it with mooTools and slick
Personally, I haven't used this, so I don't know browser support and this is pretty much the only resource I ever found on custom pseudo classes.
Edit:
So pretty much, no, you can't do what you want, as you will always need JavaScript to do what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With