Created
September 10, 2017 17:15
-
-
Save idevwise/8bcb95ddad10c974fd83e36fb3540e43 to your computer and use it in GitHub Desktop.
JavaScript for the absolutely positioned layout built for
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
document.addEventListener('DOMContentLoaded', () => { | |
setPlatformInfo(); | |
var inputBox = document.querySelector('.safari #inputBox'); | |
if(inputBox) { | |
inputBox.addEventListener('focus', function(e) { | |
document.body.classList.add('keyboard'); | |
setTimeout(function() { | |
window.scrollTo(0, 0); | |
}, 200); | |
}); | |
inputBox.addEventListener('blur', function(e) { | |
document.body.classList.remove('keyboard'); | |
}); | |
} | |
}); | |
function setPlatformInfo() { | |
var ua = navigator.userAgent.toLowerCase(); | |
if (ua.indexOf('safari') != -1) { | |
if (ua.indexOf('chrome') > -1) { | |
document.body.classList.add('chrome'); | |
} else { | |
document.body.classList.add('safari'); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment