Angel Politis Angel Politis - 2 years ago 78
jQuery Question

Is it possible to create custom CSS pseudo-classes?

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?

Answer Source

If your question is, can I create a custom pseudo, example;

div:my-custom-pseudo { }

Then not without some JavaScript library's.

Tutorial on using it with mooTools and slick

Personally I haven't used this so I dont know browser support & this is pretty much the only resource I ever found on custom pseudo classes.

Edit -

So pretty much no you cant do what you want, as you will always need JavaScript to do what you want.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download