Any way to prevent horizontal scrolling triggering swipe back gesture on OS X Lion Safari?

后端 未结 8 1938
南笙
南笙 2021-01-30 04:09

I am working on a UI that uses horizontal scrolling in a div element (using overflow: scroll). I cannot scroll to the left, because it would start the

8条回答
  •  [愿得一人]
    2021-01-30 04:39

    Yes, in order to disable default behavior (swipe, pinch etc.) all you have to do is to add:

    event.preventDefault();
    

    In you case simply register touchMove listener and use preventDefault() there (in function "touchmove").

    element.addEventListener("touchmove", touchMove, false);
    

提交回复
热议问题