title: $("#id").scrollTop() returns null
body: <p>I am trying to get the position of a coulpe  in my html page using the scrollTop() method in order to compare it with the position of the user, but it only returns null. Here is the code:</p>
  
  <pre><code>&lt;div id="div1" class="transition"&gt;
      &lt;img src="bg1.jpg"/&gt;
  &lt;/div&gt;
  
  &lt;div id="div2" class="transition"&gt;
      &lt;img src="bg2.jpg"/&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and the javascript:</p>
  
  <pre><code>var t1 = $('#div1').scrollTop();
  var t2 = $('#div2').scrollTop();
  
  console.log(t1 + " " + t2);
  </code></pre>
  
  <p>and it prints t1 and t2 = null.
  Can you see where the problem is?</p>