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 Sam Deering
Sam Deering is a Front-end Web Developer who specialises in JavaScript & jQuery. Sam is driven and passionate about sharing his knowledge to educate others.

No Reader comments

Related books & courses
Available now on SitePoint Premium

Preview for $1