This is my code:
$('#ss a:active').parent().addClass('ss-active');
I guess you can tell from my code what I want to do, but it's not working, how can I do this? and I also want when the user removes the mouse from the button to come back to normal state, what I mean by: "the user removes the mouse from the button" is that the user can only hold click on the button for a while and it should see the:active statement.
I can't do this with css because I need the parent of that <a>.
//Here it is, how I got it working!
$('#solicita a').mousedown(function() {
if($(this).parent().hasClass('solicita-hover'))
{
$(this).parent().removeClass('solicita-hover');
$(this).parent().addClass('solicita-active');
}
}).mouseleave(function() {
$(this).parent().removeClass('solicita-active');
});
Try using the mousedown() event:
$('#ss a').mousedown(function() {
$(this).parent().addClass('ss-active');
}).mouseup(function() {
$(this).parent().removeClass('ss-active');
});
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