Why does jquery's addClass and removeClass functions not work in this case?
<p>In a page I'm working on, jquery's <code>addClass()</code> and <code>removeClass()</code> only work sporadically.</p>

<p>Check out:
<a href="http://retype.se/temp/scrolltest/test.html" rel="nofollow">http://retype.se/temp/scrolltest/test.html</a></p>

<p>Line 162-171 for example:</p>

<pre><code>if(direction === 'down'){
     console.log('downer');
 console.log(affected);
 $(affected).removeClass('attached');
 $(affected).removeClass('parked-top');
 $(affected).addClass('parked-bottom');
}
</code></pre>

<p>It writes downer and the actual element to log, but does not change classes.</p>

<p>It does not throw an error or anything, but just ignores it.</p>

<p><strong>Edit: saved it to jsfiddle,</strong>
<a href="http://jsfiddle.net/at9dZ/2/" rel="nofollow">http://jsfiddle.net/at9dZ/2/</a></p>

<p>As you can see, if you uncomment the alert above these lines, it will alert...</p>
