window.scrollTo works well in most situations on mobile safari, except when the iOS status bar is tapped.

When the status bar is tapped, the page scrolls to the top and url bar is shown, then window.scrollTo doesn't work anymore.

You can try it by

setInterval(function(){
	window.scrollTo(0,1);
},1000);

The url bar will not hide after tapping the status bar because window.scrollTo is disabled.

To re-enable it, either:

  1. User scrolls the page, or
  2. Trigger window.scrollTo by user interaction, such as click and touchend
Blog Logo

b123400


Published