Skip to content

Instantly share code, notes, and snippets.

@tsmd
Last active December 26, 2020 13:14
Show Gist options
  • Save tsmd/a187f542505967a19995d110763db288 to your computer and use it in GitHub Desktop.
Save tsmd/a187f542505967a19995d110763db288 to your computer and use it in GitHub Desktop.
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no" id="meta-viewport">
<script>
!function() {
var viewport = document.getElementById('meta-viewport');
function onResize () {
var value = window.outerWidth < 375 ? "width=375" : "width=device-width,initial-scale=1,shrink-to-fit=no";
if (viewport.getAttribute('content') !== value) {
viewport.setAttribute('content', value);
}
}
addEventListener('resize', onResize, false);
onResize()
}();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment