Created
August 27, 2012 08:46
-
-
Save ffdead/3486736 to your computer and use it in GitHub Desktop.
Solved position: fixed scrollTo() bug on iOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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); | |
}, |
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
Inspired by http://stackoverflow.com/questions/11297641/mobile-webkit-reflow-issue/11479118#11479118
Using rightPadding has same effect as width but with no layout side effects