title: Obtaining scroll position on mobile phone/device
body: <p>I want to make a mobile device to scroll to a certain position and then output it as an alert. My code works fine in chrome on my PC but not on mobile devices. When I run developer tools in chrome on my PC and select view on mobile devices it doesn't work, even though it works fine in the PC view mode. If I set the position to say 30 pixels the screen doesn't move at all, in mobile device view, and the alert comes back with zero. What am I doing wrong?</p>
  
  <pre><code>&lt;!DOCTYPE HTML&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"&gt;
  &lt;link href="//fonts.googleapis.com/css?family=Open+Sans:400,400i,300,700" rel="stylesheet" type="text/css"&gt;
  &lt;script src="crafty/crafty_postcode.class.js"&gt;&lt;/script&gt; 
  &lt;script src="https://code.jquery.com/jquery-1.10.2.js"&gt;&lt;/script&gt;    
  &lt;script type="text/javascript" src="https://cc-cdn.com/generic/scripts/v1/cc_c2a.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"&gt; 
  &lt;/script&gt;
  &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"&gt; 
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body id="mainBodyId" style="margin-left:0.25cm;height: 1500px;width:1200px;"  &gt;'
  
  &lt;script  language="JavaScript" type="text/javascript"&gt; 
  window.scrollTo(0,30);
  alert('Current scroll from the top: ' + window.pageYOffset);
  &lt;/script&gt;
  
  &lt;form&gt;
  &lt;span&gt;
      1&lt;br&gt;2&lt;br&gt;3&lt;br&gt;4&lt;br&gt;5&lt;br&gt;6&lt;br&gt;6&lt;br&gt;7&lt;br&gt;8&lt;br&gt;9&lt;br&gt;10&lt;br&gt;1&lt;br&gt;2&lt;br&gt;3&lt;br&gt;4
      &lt;br&gt;5&lt;br&gt;6&lt;br&gt;6&lt;br&gt;7&lt;br&gt;8&lt;br&gt;9&lt;br&gt;10&lt;br&gt;1&lt;br&gt;2&lt;br&gt;3&lt;br&gt;4&lt;br&gt;5&lt;br&gt;6&lt;br&gt;6&lt;br&gt;7
      &lt;button&gt;test&lt;/button&gt;
      &lt;br&gt;8&lt;br&gt;9&lt;br&gt;10&lt;br&gt;1&lt;br&gt;2&lt;br&gt;3&lt;br&gt;4&lt;br&gt;5&lt;br&gt;6&lt;br&gt;6&lt;br&gt;7&lt;br&gt;8&lt;br&gt;9&lt;br&gt;10&lt;br&gt;
      1&lt;br&gt;2&lt;br&gt;3&lt;br&gt;4&lt;br&gt;5&lt;br&gt;6&lt;br&gt;6&lt;br&gt;
      &lt;button&gt;test&lt;/button&gt;
      1&lt;br&gt;2&lt;br&gt;3&lt;br&gt;4&lt;br&gt;5&lt;br&gt;6&lt;br&gt;6&lt;br&gt;7&lt;br&gt;8&lt;br&gt;9&lt;br&gt;10&lt;br&gt;1&lt;br&gt;2&lt;br&gt;3&lt;br&gt;4&lt;br&gt;
      5&lt;br&gt;6&lt;br&gt;6&lt;br&gt;7&lt;br&gt;8&lt;br&gt;9&lt;br&gt;10&lt;br&gt;1&lt;br&gt;2&lt;br&gt;3&lt;br&gt;4&lt;br&gt;5&lt;br&gt;6&lt;br&gt;6&lt;br&gt;7&lt;br&gt;
      8&lt;br&gt;9&lt;br&gt;10&lt;br&gt;1&lt;br&gt;2&lt;br&gt;3&lt;br&gt;4&lt;br&gt;5&lt;br&gt;6&lt;br&gt;6&lt;br&gt;7&lt;br&gt;8&lt;br&gt;9&lt;br&gt;10&lt;br&gt;1&lt;br&gt;
      2&lt;br&gt;3&lt;br&gt;4&lt;br&gt;5&lt;br&gt;6&lt;br&gt;6&lt;br&gt;7&lt;br&gt;8&lt;br&gt;
      &lt;button&gt;test&lt;/button&gt;
      &lt;br&gt;10&lt;br&gt;1&lt;br&gt;2&lt;br&gt;3&lt;br&gt;4&lt;br&gt;5&lt;br&gt;6&lt;br&gt;6&lt;br&gt;7&lt;br&gt;8&lt;br&gt;9&lt;br&gt;10&lt;br&gt;1&lt;br&gt;2&lt;br&gt;3
      &lt;br&gt;4&lt;br&gt;5&lt;br&gt;
      &lt;button&gt;test&lt;/button&gt;
      6&lt;br&gt;6&lt;br&gt;7&lt;br&gt;8&lt;br&gt;9&lt;br&gt;10&lt;br&gt;1&lt;br&gt;2&lt;br&gt;3&lt;br&gt;4&lt;br&gt;5&lt;br&gt;6&lt;br&gt;6&lt;br&gt;7&lt;br&gt;8&lt;br&gt;
      9&lt;br&gt;10&lt;br&gt;1&lt;br&gt;2&lt;br&gt;3&lt;br&gt;4&lt;br&gt;5&lt;br&gt;6&lt;br&gt;6&lt;br&gt;7&lt;br&gt;8&lt;br&gt;9&lt;br&gt;10&lt;br&gt;1&lt;br&gt;2&lt;br&gt;
      3&lt;br&gt;4&lt;br&gt;5&lt;br&gt;6&lt;br&gt;6&lt;br&gt;7&lt;br&gt;8&lt;br&gt;9&lt;br&gt;10&lt;br&gt;1&lt;br&gt;2&lt;br&gt;3&lt;br&gt;4&lt;br&gt;5&lt;br&gt;6&lt;br&gt;6
      &lt;br&gt;7&lt;br&gt;8&lt;br&gt;9
      &lt;button&gt;test&lt;/button&gt;
      &lt;br&gt;10&lt;br&gt;1&lt;br&gt;2&lt;br&gt;3&lt;br&gt;4&lt;br&gt;5&lt;br&gt;6&lt;br&gt;6&lt;br&gt;7&lt;br&gt;8&lt;br&gt;9&lt;br&gt;10&lt;br&gt;1&lt;br&gt;2&lt;br&gt;
      3&lt;br&gt;4&lt;br&gt;5&lt;br&gt;6&lt;br&gt;6&lt;br&gt;7&lt;br&gt;8&lt;br&gt;9&lt;br&gt;10&lt;br&gt;
      &lt;button&gt;test&lt;/button&gt;
  &lt;/span&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I expect the screen to move to 30 pixels vertically and the alert to output 30 while in chrome developer tools, mobile device view.</p>