Jaw Ali
Jaw Ali

Reputation: 205

How to stop the ipad web page slide when we click on input field

I have web page in which i have input field when i enter any data in textfield screens slides up i want to stop this slides,i have searches some people say it is by default in ipad you can not fix it any idea how tackle this issue.

here is my code

      <!DOCTYPE HTML>
      <html lang = "en">
      <head>
      <title>formDemo.html</title>
      <meta charset = "UTF-8" />
      <script>
      function test(){

      alert("Working");
      window.scrollTo(0,600);

       }
      </script>
      </head>
      <body>
     <h1>Form Demo</h1>
     <form>
      <label for="name">Text Input:</label>
      <input type="text"  onKeyPress="test()" name="name" id="name" value="" style="margin:400px 0 0 0;" />
      </form>
      </body>
      </html>

Upvotes: 1

Views: 287

Answers (1)

wandarkaf
wandarkaf

Reputation: 1889

Disabled scrolling with this:

<script type="text/javascript">
 $(document).ready(function() { 
   document.ontouchmove = function(e){
     e.preventDefault();
   }
 });
</script>

Upvotes: 2

Related Questions