Skip to content

Instantly share code, notes, and snippets.

@terrencewood
Created June 22, 2014 20:14
Show Gist options
  • Select an option

  • Save terrencewood/c0979346552bd2b1608d to your computer and use it in GitHub Desktop.

Select an option

Save terrencewood/c0979346552bd2b1608d to your computer and use it in GitHub Desktop.
iOS minimal-ui orientation change fix
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimal-ui">
<title>Title</title>
<style>
body {
-webkit-text-size-adjust: 100%;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.wrapper {
overflow-y: scroll;
-webkit-overflow-scrolling: touch;
}
</style>
<script>
window.addEventListener("orientationchange", function() {
window.scrollTo(0,0);
});
</script>
</head>
<body>
<div class="wrapper">
<div><!-- this section scrolls --></div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment