Skip to content

Instantly share code, notes, and snippets.

@gmelikov
Last active January 30, 2018 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gmelikov/a00e12139c583bb31c41f125f1c8a607 to your computer and use it in GitHub Desktop.
Save gmelikov/a00e12139c583bb31c41f125f1c8a607 to your computer and use it in GitHub Desktop.
html autozoom page for screen width
Add to <head>:
```
<meta id="Viewport" name="viewport" content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<script type="text/javascript">
var ww=320; //maximum body size in pixels
var ratio = window.innerWidth / ww;
document.querySelector('meta[name="viewport"]').setAttribute("content", 'initial-scale=' + ratio + ', maximum-scale=' + ratio + ', minimum-scale=' + ratio + ', user-scalable=yes, width=' + ww);
</script>
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment