Skip to content

Instantly share code, notes, and snippets.

@juliancruzsanchez
Created October 15, 2018 03:27
Show Gist options
  • Save juliancruzsanchez/d01b283ca54df0cd7dd2765f803668b4 to your computer and use it in GitHub Desktop.
Save juliancruzsanchez/d01b283ca54df0cd7dd2765f803668b4 to your computer and use it in GitHub Desktop.
<script>
iPhoneX(); window.onresize = window.onorientationchange = function () { setTimeout(iPhoneX, 100); }
function iPhoneX() {
if (window.innerHeight == 812 && window.innerWidth == 375 ) {
document.getElementById('app').style.paddingTop = '20px';
if (!document.getElementById('iphone_layout')) {
var img = document.createElement('img');
img.id = 'iphone_layout';
img.style.position = 'fixed'; img.style.height = '100%'; img.style.width = '100%';
img.style.zIndex = 9999;
img.style.pointerEvents = 'none';
img.src = 'https://i.stack.imgur.com/k5RNK.png'
document.body.insertBefore(img, document.body.children[0]);
}
} else if (document.getElementById('iphone_layout')) {
document.body.removeChild(document.getElementById('iphone_layout'));
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment