title: jQuery Event after changing class with toggleClass
body: <p>I have a problem with jQuery and the toggleClass(). 
  I want to create a div, which closes on clicking a button. The button changes and when I click again on this button the div will open again. </p>
  
  <p>The problem is: When I click on the button the div closes and the class of the button changes - thats fine. But now when I click on the button with the new class - nothing happens. </p>
  
  <p>Here is my code: </p>
  
  <pre><code>&lt;div class="content"&gt;
          &lt;div class="contentclose"&gt;&lt;/div&gt;
          &lt;p&gt;Text here&lt;/p&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>and the jQuery: </p>
  
  <pre><code>$( document ).ready(function() {
  $(".contentclose").click(
      function() {
          $(".content").animate({
              "height": "45px",
              "width": "45px",
              "padding": "0px"
          }, 1000);
          $(".content").children("p").animate({
              "opacity": "0"
          }, 1000);
  
          $(".contentclose").toggleClass("contentclose contentopen");
  
  }
  );
  
  $(".contentopen").click(
      function() {
          $(".content").animate({
              "height": "400px",
              "width": "200px",
              "padding": "50px"
          }, 1000);
          $(".content").children("p").animate({
              "opacity": "1"
          }, 1000);
  
          $(".contentopen").toggleClass("contentopen contentclose");
  
  }
  ); });
  </code></pre>
  
  <p>I hope you can help me... </p>