title: Automaticly scrollTo closest div
body: <p>I'm building a single page ScrollTo website with 4 div's. These divs represent my pages.</p>
  
  <pre><code>Home -&gt; My work -&gt; About me -&gt; Contact
  </code></pre>
  
  <p>The width and hight are defined by a small piece of javascript that reads the users screen resolution on bodyload or resize. So the divs are always the inner-width and height of the users screen.</p>
  
  <pre><code>function resize() {
  
      document.getElementById("home").style.height = viewportheight+"px";
      document.getElementById("work").style.height = viewportheight+"px";
      document.getElementById("about").style.height = viewportheight+"px";
      document.getElementById("contact").style.height = viewportheight+"px";
  </code></pre>
  
  <p>What I'm trying to accomplish is that once the user scrolls (let's say 100px down or up), the window automaticly snaps to the top of the nearest div. </p>
  
  <p>Something like:</p>
  
  <pre><code>onScroll("100px") up or down { scrollTo("closest #div") };
  </code></pre>