Changing :hover to touch/click for mobile devices

后端 未结 9 1991
余生分开走
余生分开走 2020-11-28 19:43

I\'ve had a look around but can\'t quite find what i\'m looking for.

I currently have a css animation on my page which is triggered by :hover. I would like this to c

9条回答
  •  一个人的身影
    2020-11-28 20:13

    Well I agree with above answers but still there can be an another way to do this and it is by using media queries.

    Suppose this is what you want to do :

    body.nontouch nav a:hover {
        background: yellow;
    }
    

    then you can do this by media query as :

    @media(hover: hover) and (pointer: fine) {
        nav a:hover {
            background: yellow;
        }
    }
    

    And for more details you can visit this page.

提交回复
热议问题