Prevent swiping between web pages in iPad Safari

后端 未结 6 1086
执念已碎
执念已碎 2020-12-30 04:30

Swiping from the left and right edges of my iPad\'s Safari browser, moves between the currently open web pages. Is there any way to prevent it?

I have tried to add <

6条回答
  •  渐次进展
    2020-12-30 05:18

    Apple provided these guidelines after iOS9.

    The guide lets you disable

    1. Scrolling

      function touchMove(event) {
        // Prevent scrolling on this element
        event.preventDefault();
        ...
      }
      
    2. Pinch and Zoom

      function gestureChange(event) {
        // Disable browser zoom
        event.preventDefault();
        ...
      }
      

    You can identify a swipe gesture as follows:

    1. Begin gesture if you receive a touchstart event containing one target touch.
    2. Abort gesture if, at any time, you receive an event with >1 touches.
    3. Continue gesture if you receive a touchmove event mostly in the x-direction.
    4. Abort gesture if you receive a touchmove event mostly the y-direction.
    5. End gesture if you receive a touchend event.

    The full guide is poster here.

    Let me know if you need more help.

    Nitin, Defuzed

提交回复
热议问题