title: If Else Statement - Jquery Animate
body: <p>Bit of a JQuery beginner - trying to animate a "tab" to follow the class "StaffPanel" as it animates outwards.</p>
  
  <p>Below are my scripts.  The second one works properly, animating the class outwards and attaching the .StaffTriggerActive to the button.</p>
  
  <p>Problem is,  I can't seem to figure out how to write a if else statement to make the button animate to the closed state once the user closes the button..</p>
  
  <p>I obviously am doing something wrong - any one with ideas?</p>
  
  <pre><code>$(document).ready(function() {    
      $('.StaffTrigger').click(function() {
          if($(this).hasClass('.StaffTriggerActive')) {
                  $(".StaffTriggerActive").animate ({
                  right: '=0'
                  }, "fast"); 
          }
          else {
                  $(".StaffTriggerActive").animate ({
                  right: '=340'
                  }, "fast");
          }
      });
  });
  
  $(document).ready(function(){
      $(".StaffTrigger").click(function(){
  
      $(".StaffPanel").toggle("fast");
          $(this).toggleClass("StaffTriggerActive");
          return false;
      });
  });
  </code></pre>