Skip to content

Instantly share code, notes, and snippets.

@ffdead
Created August 27, 2012 08:46
Show Gist options
  • Save ffdead/3486736 to your computer and use it in GitHub Desktop.
Save ffdead/3486736 to your computer and use it in GitHub Desktop.
Solved position: fixed scrollTo() bug on iOS
/**
* Causes the browser to reflow all elements on the page.
* Fix for the iOS5 bug where fixed positioned elements are
* unavailable after programmatically calling window.scrollTo()
*
* @autor [email protected]
*/
reflowFixedPositions: function () {
document.documentElement.style.paddingRight = '1px';
setTimeout(function () {
document.documentElement.style.paddingRight = '';
}, 0);
},
@sanex3339
Copy link

any solution for IOS8 safari? padding, width and other tricks not help me, only
var scrollPos = window.pageYOffset;
var tempScrollPos = scrollPos - 1;
$('body, html').scrollTop(tempScrollPos).animate({scrollTop: scrollPos}, 1);

But i doesnt like that solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment