简体   繁体   中英

How to stop elastic scrolling (aka scroll bounce, aka page overscroll effect) on iOS home screen links?

I managed to disable the scrolling overshot effect ("rubber band"?) on my web page by overriding the touchmove event. This is working well on mobile safari.

But when I add a shortcut to my page in the iPad home screen, the effect is again active.

How can I disable it there too?

I'm guessing that the method you used to stop the rubber-banding effect is:

JQuery

$(document).bind(
  'touchmove',
  function(e) {
    e.preventDefault();
  }
);

or

Javascript

document.addEventListener(
  'touchmove',
  function(e) {
    e.preventDefault();
  },
  false
);

If it was neither of those, try that first.

However, if you are still having trouble with elasticity, try using something like this , or this:

Javascript

function BlockMove(event) { 
  event.preventDefault(); 
}

HTML

<body ontouchmove="BlockMove(event);">
</body>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM