title: Problem with slideUp/slidedown in a if statement -jQuery
body: <p>I have a problem regarding accordion effect I want to make. </p>
  
  <p>I would like to have following functionality - If you press anywhere in "div.post" the text surrounded in "p.read-more", which is hidden from start, slides down and reveal itself. Then to close it, you need to press "div.close".</p>
  
  <p>I have tried something like this, but frankly, as you probably can see, I'm lost :-)</p>
  
  <p>This is the HTML</p>
  
  <pre><code>&lt;div class="post"&gt;
      &lt;p&gt;This is a beginning of a text.&lt;/p&gt;
      &lt;p class="read-more"&gt;... This is the rest of the text&lt;/p&gt;
      &lt;div class="close"&gt;This is a close button&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I have tried something like this</p>
  
  <pre><code>$("p.read-more").hide();
  
  $('div.post').click(function(){         
      $(this).toggleClass("active"); 
  });
  
  if( $('div.post').hasClass('active') ) {
      $('div.close').click(function(){
          $(this).find(".read-more").slideUp();        
      }); 
  
  } else {
      $(this).click(function() {
          $(this).find(".read-more").slideDown();
      });
  }
  </code></pre>
  
  <p>Thank you for any help.</p>