Touch API (e.g. touchstart) not working in MS Edge

前端 未结 3 1072
甜味超标
甜味超标 2020-12-28 18:00

my application is using the Touch API to detect touch events in JavaScript. Example:

$(\".element\").on(\"touchstart\", function(event){
    alert(\"TRUE\");         


        
相关标签:
3条回答
  • 2020-12-28 18:15

    Try using the pointerdown event. Some (much) more information. As you can see, touchstart is triggered by Edge but not in all configurations, when a keyboard is attached/paired for example, no touchstart.

    0 讨论(0)
  • 2020-12-28 18:20

    Did you enable custom touch handling ? You can do it with the following css snippet (on the body tag or just a container for geastures) :

    -ms-touch-action: none;
    

    Next, touch API is a webkit feature (maybe there is an error in CanIuse ?). IE and Edge have a similar feature known as Pointer API. But you can use a polyfill library like this : https://github.com/CamHenlin/TouchPolyfill

    0 讨论(0)
  • 2020-12-28 18:25

    for touch API, you have to activate a flag on Edge : in the address bar, enter about:flags and press enter. In the section Touch, you can enable touch events with the corresponding dropdown

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