Reputation: 2327
I am looking to target the :active psuedo class in jQuery. Essentially when the active state is activated, I would like a simple animation to occur. Is there a way to target ":active" just as there is in CSS?
Upvotes: 1
Views: 313
Reputation: 2557
for inputs i think this will be what you want
$(":input").focusin(function() { .... });
$(":input").focusout(function() { .... })
Upvotes: 0
Reputation: 191819
There is no way to do this in JavaScript, but you can bind the animation to events that would cause an element to be considered :active
, i.e. click
:
$(element).on('click', function () { /* anmiation * / });
Animations are also possible via CSS and you would be able to use :active
directly with those.
Upvotes: 3