title: jquery - click & activate active button
body: <p>In jQuery:</p>
  
  <p><em><strong></em> Scenario **</strong>
   - I have four Divs that have hover effects. 
   - All use a jquery animation to move the backgroundPosition to show the hover state.</p>
  
  <p><em><strong></em> Problem **</strong>
   - I want to set a focus or clicked state, so that once you have clicked on a button it animates the background position even further to show the new state. I would also like the buttons to be aware if any other buttons have been clicked and remove the current click state and begin to animate the new click state on the new selected button ...??</p>
  
  <p><em><strong></em> My efforts **</strong>
   - I have done a bit of the coding but cant seem to work out this focus state, thanks again in advance !! ;)</p>
  
  <p><em><strong></em> HTML **</strong></p>
  
  <pre><code>&lt;div class="rollOversHolderOne"&gt;
  
      &lt;div id="mainServices_01" class="rollOver_1 rollover"&gt;&lt;/div&gt;
  
          &lt;div id="mainServices_02" class="rollOver_2 rollover"&gt;&lt;/div&gt;
  
          &lt;div id="mainServices_03" class="rollOver_3 rollover"&gt;&lt;/div&gt;
  
          &lt;div id="mainServices_04" class="rollOver_4 rollover"&gt;&lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p><em><strong></em> CSS **</strong></p>
  
  <pre><code>#mainServices_01 {
      width:103px;
      height:131px;
      float:left;
      background:url(../images/slideHover.png) repeat 0 0;
      background-position: inline;
  }
  #mainServices_02 {
      width:103px;
      height:131px;
      float:left;
      background:url(../images/slideHover.png) repeat 0 0;
      background-position: inline;
  }
  #mainServices_03 {
      width:103px;
      height:131px;
      float:left;
      background:url(../images/slideHover.png) repeat 0 0;
      background-position: inline;
  }
  #mainServices_04 {
      width:103px;
      height:131px;
      float:left;
      background:url(../images/slideHover.png) repeat 0 0;
      background-position: inline;
  }
  </code></pre>
  
  <p><em><strong></em> jQuery **</strong></p>
  
  <pre><code>jQuery(document).ready(function(){
  
      var flag; 
      var active;
  
      jQuery('.rollover').css( {backgroundPosition: "0 0"} ).click(function(){
  
          flag = false;
  
          jQuery(this).stop().animate(
              {backgroundPosition:"(0 -130.5px)"}, 
              {duration:1});
  
      });
  
  
      jQuery('.rollover').mouseout(function(){
  
          if(flag == false)
          {
              jQuery(this).stop().animate(
              {backgroundPosition:"(0 -130.5px)"}, 
              {duration:1})
          }else{
              jQuery(this).stop().animate(
              {backgroundPosition:"(0 0)"}, 
              {duration:1})
          }
      });
  
  
      jQuery('.rollover').mouseover(function(){
  
              jQuery(this).stop().animate(
              {backgroundPosition:"(0 -130.5px)"}, 
              {duration:1})
              flag = true;
      });
  
  });
  </code></pre>