title: If hasClass then fire mouseover mouseout
body: <p>I'm trying to add a mouseover or hover function to a div when it has class <code>sticky</code>. So when the nav is sticky then <code>homepage-sidemenu</code> should get <code>display:none;</code>. <code>.homepage-sidemenu.sticky</code> should then become visible when you mouseover and invisible when mouseout.</p>
  
  <p>I thought this was as simple as just adding a hover function but somehow I missing something because it doesn't do what I want. The sticky class is added with a scroll function. </p>
  
  <p>A <a href="http://jsfiddle.net/meules/g4m7hgov/4/" rel="nofollow">fiddle here</a> to demonstrate what happens</p>
  
  <p>So what I have is this:</p>
  
  <pre><code>&lt;div id="nav"&gt;
   &lt;ul class="menu"&gt;
    &lt;li class="highlight"&gt;&lt;a href=""&gt;categories&lt;/a&gt;&lt;/li&gt;
   &lt;/ul&gt;
  &lt;/div&gt;
  
  &lt;div id="content"&gt;
   &lt;div class="homepage-sidemenu"&gt;
    &lt;ul&gt;
     &lt;li class="highlight"&gt;...&lt;/li&gt;
    &lt;/ul&gt;
   &lt;/div&gt;
  &lt;/div&gt;  
  
  var fixmeTop1 = $('#nav').offset().top;
  var fixmeTop = $('.homepage-sidemenu').offset().top + 100;
  $(window).scroll(function () {
      var currentScroll = $(window).scrollTop();
      if (currentScroll &gt;= fixmeTop1) {
          $('#nav').addClass("sticky");
      } else {
          $('#nav').removeClass("sticky");
      }
      if (currentScroll &gt;= fixmeTop) {
          $('.homepage-sidemenu').addClass("sticky");
      } else {
          $('.homepage-sidemenu').removeClass("sticky");
      }
  
  });
  
  $('#nav.sticky .menu li.highlight').mouseover(function () {
      if ($('.homepage-sidemenu').hasClass('sticky')) {
          $('.homepage-sidemenu.sticky').css('display', 'block');
      }
  });
  </code></pre>
  
  <p>What needs to happen is that the sidemenu disappears when the main nav is fixed/when you scroll down. When hovering the category link it should become visible. </p>
  
  <p>I tried al kinds of functions (hover, mouseenter, click etc) to get this done but with no luck. It looks like something is missing when the nav is fixed.</p>
  
  <p>Can somebody point me to some directions or tell me what I'm doing wrong?!</p>