title: jQuery window scroll snapping
body: <p>Okay, so what im trying to do is have a page with panels that span 100% of width and height.</p>
  
  <pre><code>&lt;body&gt;
    &lt;div class="panel"&gt;
    &lt;/div&gt;
    &lt;div class="panel"&gt;
    &lt;/div&gt;
    &lt;div class="panel"&gt;
    &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>Body will be overflow:hidden. what I'm trying to do is everytime the user scrolls a certain amount, let's say a swipe or a half spin of the wheel, then it scrolls to the next panel. so It's like a deck that takes the next element into the viewport.</p>
  
  <p>The way I've handled it is like this: but i cant figure out a way to not make the scroll function fire a million times.</p>
  
  <p>here's my JS: ugly
  I'm also using the mousewheel plugin.. i was thinking perhaps somehow for every x delta amount then it fires the scroll animation. But I'm not really sure how to achieve it!</p>
  
  <pre><code>var scrollAmt = 0;
          $(window).on('mousewheel', function(event, deltaY){
              $('.projects').addClass('scrolled');
              if(event.originalEvent.wheelDelta &gt; 0) {
                  //down  
                      scrollAmt = scrollAmt -= $winHeight;
                      console.log(scrollAmt);
                      $('.projects').animate({marginTop: ''+ scrollAmt +'px'}, 2000);
  
              } else {
                  if ($totalComputed === scrollAmt ){
                      console.log('last');
                  } else {
  
                          scrollAmt = scrollAmt += $winHeight;
                          console.log(scrollAmt);
                          $('.projects').stop().animate({marginTop: '-'+ scrollAmt +'px'}, 2000);
  
                  }
              }
          });
  </code></pre>
  
  <p>i've tried doing stuff with if and else statements but i just end up on square one.</p>
  
  <p>I'm trying to achieve something like <a href="http://mirkoborsche.com" rel="nofollow">http://mirkoborsche.com</a></p>
  
  <p>Any help much appreciated!</p>
  
  <p>Best,</p>