Created
March 3, 2014 19:06
-
-
Save james-huston/9332284 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<html> | |
<head> | |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> | |
<style> | |
.block_test { | |
position: absolute; | |
top: 0; | |
left: 0; | |
background-color: silver; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="block_test" resize-to-viewport> | |
super duper | |
<div> | |
<input type="text" placeholder="blarg!" id="testinput" /> | |
</div> | |
</div> | |
<script> | |
(function (window, undefined) { | |
var document = window.document; | |
var testInput = document.getElementById('testinput'); | |
var keyboardShow = new CustomEvent( | |
"onkeyboardshow", | |
{ | |
detail: { | |
}, | |
bubbles: true, | |
cancelable: false | |
} | |
); | |
var keyboardHide = new CustomEvent( | |
"onkeyboardhide", | |
{ | |
} | |
); | |
testInput.addEventListener('focus', function () { | |
document.dispatchEvent(keyboardShow); | |
}); | |
testInput.addEventListener('blur', function () { | |
document.dispatchEvent(keyboardHide); | |
}); | |
document.addEventListener('onkeyboardshow', function () { | |
console.log('keyboard show'); | |
}); | |
document.addEventListener('onkeyboardhide', function () { | |
console.log('keyboard hide'); | |
}); | |
})(window); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment