I am working on web base mobile (HTML) application. Is there any way to detect keyboard event like when keyboard is visible and keyboard hide, base on that I can control o
Using jQuery:
var lastWindowWidth = $(window).width(),
lastWindowHeight = $(window).height();
$(window).resize(function() {
var newWindowWidth = $(window).width(),
newWindowHeight = $(window).height();
if( newWindowHeight > lastWindowHeight && newWindowWidth == lastWindowWidth ) {
// Keyboard closed
// ...
}
lastWindowWidth = newWindowWidth;
lastWindowHeight = newWindowHeight;
});
Note that the window resize event (and thus the "Keyboard closed" comment block) may get called several times as the keyboard animates closed. Edit to suit your needs.