13

I've been making use of the preventDefault technique on the touchmove event since now, when I noticed it doesn't seem to work anymore on iOS 11.3, for neither Safari, nor Chrome or Firefox:

document.ontouchmove = function(event){
    event.preventDefault();
} 

Has anything changed now in iOS? What's the way of preventing the bouncing at the top or end of the page?

Reproduction online

Reproduction online with jQuery

Video here:

enter image description here

Alvaro
  • 40,778
  • 30
  • 164
  • 336

2 Answers2

8

It was caused by a bug of WebKit. Bug 182521

Try

window.addEventListener("touchstart", function(event) {
  event.preventDefault();
}, {passive: false});

as a workaround.

gman
  • 100,619
  • 31
  • 269
  • 393
gluttony
  • 446
  • 4
  • 3
3

In addition to gluttonys answer:

window.addEventListener("touchmove", function(event) {event.preventDefault();}, {passive: false} );

is for me a working solution for the safari bounce issue.

Oliver Becker
  • 161
  • 1
  • 8