title: jquery rollovers and active states
body: <p>I apologise for any stupid questions/coding, I'm very new to jquery!</p>
  
  <p>I'm trying to create a menu for a one-page site that has rollovers and an active state.  HTML:</p>
  
  <pre><code>&lt;ul id="menu"&gt;
  &lt;li&gt;&lt;a class="rollover" href="#"&gt;&lt;img class="folio" src="images/folio3.png" /&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a class="rollover" href="#"&gt;&lt;img class="services" src="images/services3.png" /&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a class="rollover" href="#"&gt;&lt;img class="about" src="images/about3.png" /&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a class="rollover" href="#"&gt;&lt;img class="contact" src="images/contact3.png" /&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>jquery:</p>
  
  <pre><code>$(document).ready(function(){   
  $("a.rollover").fadeTo(1,0.5);
  $("a.rollover").hover(
          function() {$(this).fadeTo("fast",1);},
          function() {$(this).fadeTo("fast",0.5);});
  $("a.rollover").click(function(){
  if($(".active").length) {
      if($(this).hasClass("active")) {
      $(this).removeClass("active");
      $(this).fadeTo("fast",0.5);
      } else {
      $(".active").fadeTo("fast",0.5);
      $(".active").removeClass("active");
      $(this).addClass("active"); 
      $(this).fadeTo("fast",1);
      }
  } else {    
      $(this).addClass("active");
      $(this).fadeTo("fast",1);
      }});
  });
  </code></pre>
  
  <p>So there are two problems here:</p>
  
  <ol>
  <li><p>Even though the active class is
  added and in Chrome's developer
  tools I can see that the opacity on
  an active class is "1", it doesn't
  seem to work in the browser, ie. the
  opacity still appears in the browser
  to be "0.5".</p></li>
  <li><p>If $(this) is active, even after
  clicking $(this) thus removing the
  active class, the opacity remains at
  "1". If I click $(this) several
  times, eventually the opacity
  changes back to "0.5".</p></li>
  </ol>
  
  <p>I'd really appreciate the help. I've been struggling with this for oh... 3 days now heh :-/</p>
  
  <p>Many thanks in advance...</p>