title: If statement in hover function in Jquery
body: <p>Please take a look at this <a href="http://jsfiddle.net/XNnHC/2065/" rel="nofollow">fiddle</a></p>
  
  <p>Is this how you would put an if statement in a hover function? </p>
  
  <pre><code>$( ".nn" ).hover(
    function() {
     if($(this).find('p').height() &gt; $(this).height())
     {
      $( this ).css( "height","auto" ).removeClass("oh");
     }
    }, function() {
  
      $( this ).css( "height","6em" ).addClass("oh");
  
    }
  );
  </code></pre>
  
  <p>Since the if statement is only for the first function (mouseover), does the function still trigger on the mouseout function? Is it possible to wrap the if statement around the entire hover function,something like this:</p>
  
  <pre><code>    $( ".nn" ).hover(
  
      function() {
      if($(this).find('p').height() &gt; $(this).height())
      {
         $( this ).css( "height","auto" ).removeClass("oh");
  
        }, function() {
  
          $( this ).css( "height","6em" ).addClass("oh");
  
        }
      }
      );
  </code></pre>
  
  <p>HTML
       <p>Very long text</p></p>
  
  <pre><code>&lt;div class="nn oh"&gt;&lt;p&gt;short text&lt;/p&gt;&lt;/div&gt;
  </code></pre>