Here is the code I have been working on:
$('#ss a:active').parent().addClass('ss-active');
It seems like my code is not functioning as expected. Can you help me figure out how to achieve my desired outcome? Additionally, I want the button to return to its normal state when the user moves the mouse away from it. By "removing the mouse from the button," I mean that the user should only click and hold on the button briefly to trigger the :active
state.
I am unable to accomplish this using CSS alone because I require access to the parent element of the <a>
tag.
//After troubleshooting, I managed to make it work with the following solution:
$('#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');
});