Skip to main content

iPad IOS7 Page Jump Fix when keyboard closes

By Sam Deering

JavaScript

Share:

Free JavaScript Book!

Write powerful, clean and maintainable JavaScript.

RRP $11.95

When you click on open space on the ipad the keyboard the page jumps down screen (to try and compensate for the space the keyboard used). This occurs when it wants to keep the input in view when your typing which makes sense and is useful but when you don’t use the keyboard close button it sometimes gets all confused and jumps the page…

To fix include:

HammerJS

Then add this:

$('body').on("tap", function() {
            // alert('you touched me!');
            window.scrollTo(0, 0);
        });

Source:

Or if you want smoother scrolling include this:

$('body').on("tap", function() {
            // alert('you touched me!');
            window.scrollTo(0);
        });

Source: http://flesler.com/jquery/scrollTo/

Sam Deering has 15+ years of programming and website development experience. He was a website consultant at Console, ABC News, Flight Centre, Sapient Nitro, and the QLD Government and runs a tech blog with over 1 million views per month. Currently, Sam is the Founder of Crypto News, Australia.

New books out now!

Get practical advice to start your career in programming!


Master complex transitions, transformations and animations in CSS!