hasClass is not working when page is refreshed
<p>I'm trying to say if <code>body</code> has x class to add x class.</p>

<p><strong>Javascript</strong></p>

<pre><code>$('body').toggleClass('projectLoaded');
$('[data-type="projectLoader"]').click(function() {
  var proj = $(this)[0].getAttribute('data-project');
  $('#arrow-nav').addClass('slideIn');

  updateHash(proj);
  return false;
});
$('[data-type="projectDie"]').click(function() {

  $('body').removeClass('projectLoaded');
  $('#arrow-nav').removeClass('slideIn');
  return false;
});

if ($('body').hasClass('projectLoaded')) {
  $('#arrow-nav').addClass('slideIn');
} else {
  $('#arrow-nav').removeClass('slideIn');
}
</code></pre>

<p>When <code>projectLoaded</code> is triggered, the <code>addClass</code> does work for <code>slideIn</code>, but when I refresh, even though <code>projectLoaded</code> is active, the <code>addClass</code> disappears. I thought a <code>hasClass</code> would work but it doesn't. Everything works but, it's just on refresh it disappears.</p>

<p>Working page <a href="http://darrenbachan.com/" rel="nofollow">here</a>, click a project and you'll <code>#arrow-nav.slideIn</code> working, but refresh and the <code>.slideIn</code> isn't added.</p>

<p><strong>UPDATE</strong>
This is what worked for me:</p>

<pre><code>$( 'document' ).ready(function() {
        if ($('body').hasClass('projectLoaded')) {
            $('#arrow-nav').addClass('slideIn');
        } else {
            $('#arrow-nav').removeClass('slideIn');
        }
});
</code></pre>

<p>or</p>

<pre><code>$( 'body.projectLoaded' ).ready(function() {
    $('#arrow-nav').addClass('slideIn');
});
</code></pre>

<p>If this is not proper or there's a more efficient way of doing this please submit it below.</p>