how to deal with hover effect on touch devices

后端 未结 2 1438
深忆病人
深忆病人 2021-01-07 15:10

i have following code


      
      
2条回答
  • 2021-01-07 15:31

    Try this:

    <script>
    document.addEventListener("touchstart", function(){}, true);
    </script>
    
    0 讨论(0)
  • 2021-01-07 15:32

    Several solutions:

    • 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 (see this Question on StackOverflow
    0 讨论(0)
提交回复
热议问题