Imran Husain
Imran Husain

Reputation: 1

Screen shifting when iPad keyboard opens

I have developed an iPad web app using HTML, CSS and JavaScript. I have a simple input field on one of the screens. Whenever I click on the input field, the iPad keyboard pops up from the bottom (which is fine) but then the entire screen shifts to the left. It then stays in this position until I double tap on the iPad screen which makes the screen shift right to its original position. Does anyone know how to fix this?

Upvotes: 0

Views: 713

Answers (1)

Dan Barzilay
Dan Barzilay

Reputation: 4983

$(document).ready(function(){
    $('input').bind('focus',function() {
        $(window).scrollTop(10);
        var keyboard_shown = $(window).scrollTop() > 0;
        $(window).scrollTop(0);
        if(keyboard_shown)
        {
            //your screen shifting code
        }
    });
});

Upvotes: 1

Related Questions