0

I'm currently facing some difficulty with the hover and active for mobile. Here is a link to my code: https://codesandbox.io/s/inspiring-wozniak-33l61?file=/src/Portfolio.scss

I'm trying to change the background color of the containers when I click for mobile, it currently works for web as it is hover. I've tried adding the :active effect, but it only works on mobile if the user currently holds down the container which is not very ideal. I'm trying to change the background color when the user clicks/touches on the container once instead of holding down.

Any help would be much appreciated, thank you!

hoseh
  • 129
  • 1
  • 3
  • 14

1 Answers1

0

You an try detecting browser platform and handle onClick if it is mobile.

  • how would I go about doing that? – hoseh Jun 29 '21 at 06:49
  • Put onClick and inside handler check if mobile using this: [link](https://stackoverflow.com/questions/11381673/detecting-a-mobile-browser) If it is mobile then you can set some flag if clicked and conditionally put your required class – Milind Sharma Jun 29 '21 at 07:01