title: Assigning class based on scroll causing conflict
body: <p>I need to add/remove css classes when user scroll the page according to the visible div.</p>
  
  <p>I have two blocks (white and black).
  Now I'm doing this:</p>
  
  <pre><code>$(window).scroll(function(event) {
  
     var scroll = $(window).scrollTop();
  
     if(scroll &gt;= $('div.white').offset().top){
         //do things
     }
  
     if(scroll &gt;= $('div.black').offset().top){
         //do things
     }
  }
  </code></pre>
  
  <p>The problem occurs when there is an alternance between the two classes, when a <code>.white</code> div follows a <code>.black</code> one. How can I better write this?</p>
  
  <p>Thank you.</p>