-
-
Save CreatiCoding/0c32f14101d4ccd565ff782cb996aefc to your computer and use it in GitHub Desktop.
hasSafeArea()
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
function hasSafeArea() { | |
const div = document.createElement('div'); | |
const computed = getComputedStyle(div); | |
div.style.paddingBottom = 'env(safe-area-inset-bottom)'; | |
document.body.appendChild(div); | |
const bottom = parseInt(computed.paddingBottom) || 0; | |
document.body.removeChild(div); | |
return !!bottom; | |
} | |
hasSafeArea(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment