Created
October 15, 2018 03:27
-
-
Save juliancruzsanchez/d01b283ca54df0cd7dd2765f803668b4 to your computer and use it in GitHub Desktop.
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
<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