hover event on touch device

前端 未结 3 1409
小鲜肉
小鲜肉 2021-01-26 00:06

I decrease opacity of

    when mouse over the
      tag area and then set full opacity for
    • which user is on that.
相关标签:
3条回答
  • 2021-01-26 00:32

    On touch devices, hover is not supported. You can either:

    • skip hover effects in touch device stylesheets
    • use JavaScript to turn hover into click interactions
    • use JavaScript to simulate hover interactions on the touch device

    There are multiple other posts on SO that discuss about this problem:

    How do I simulate a hover with a touch in touch enabled browsers?
    how to deal with hover effect on touch devices
    Hover for Touch Devices

    0 讨论(0)
  • 2021-01-26 00:38

    Since :hover is of course not supported in touch only browsers, you can use the touchStart, touchMove, and touchEnd events (through javascript). These are used very well in the FastClick library.

    Also some CSS :hover events can be activated through a touch only browser if you hold your finger on the screen.

    0 讨论(0)
  • 2021-01-26 00:38

    A bit late...

    but you could use css animations to show the menu for 4-5 seconds before hiding it again...

    not perfect but you get rid of the JS .. not that js is wrong, i use angularJS..

    EDIT: -- were asked to ref hers a link http://www.greywyvern.com/?post=337

    0 讨论(0)
提交回复
热议问题