Design comparison
Solution retrospective
Couldn't figure out hot to maintain active state of the button for hovered color to remain same even when mouse leaves, any idea?
Percentage buttons are styled with Grid and the main container is styled with grid only for desktop site...
Any suggestions...?
Community feedback
- @DyiosPosted about 3 years ago
Hi, you can make a class that have the styles of the active state and when the user clicks on the tip percentage you add the class to the clicked button.
Marked as helpful1@irudhirnPosted about 3 years ago@Dyios I actually did, but it seemed useless to me because as soon as mouse leaves, button background color came back to normal state, what I was looking for is ':visited' state of the button so for background color of button to remain as it's in ':hover' or ':active' state, as it is available for links(<a> tag)....do you have any solution regarding ':visited' state of the button?
0@DyiosPosted about 3 years ago@irudhirn i'm not 100% sure if i understand what you mean, but i think you want the same thing that i did on my solution, when the user clicks it will be active even if he no longer hovers the button. for this you need to use javascript, you listen for the event onClick and when the user clicks you add a class with active, so even when the mouse leaves, the button still have the active class.
0 - @IDavidSaPosted about 3 years ago
You can add a stylized class through a javascript event (in this case, click).
Marked as helpful0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord