I would style the css :hover, :active and :focus states, and maybe  use
jquery to add to the selected link a specific "current" id, styled the same
way. 

And then simply style the a:visited and a:link as the default state via CSS.


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Bruce MacKay
Sent: mercredi 14 mars 2007 11:33
To: [email protected]
Subject: [jQuery] Swapping css of non-adjacent link tags

Hello folks,

I'm seeking some help in changing the (in this case) background colour of
links once they've been clicked.

I have an application that contains many (50-100) links on a page.  Clicking
on any one brings specific content into a neighbouring div.

What I want to do is to change the background colour of the most recently
clicked link so that a user can see at a glance where they are in the list.

This has two parts - the changing of the background colour of the current
link to the highlight colour, and the change of the previously highlighted
link back to the default.

The first part I can do:
$("#jqtree
a").bind("click",function(){$(this).css("background","#CC004E")});

I cannot do the second part. The previous and current links will not
necessary be adjacent in the list and with so many links on the page, I'm
wary of doing a global "set-to-default-colour" sweep of all links on the
page before changing the colour of the most recently clicked link.

I'd appreciate directions to a better way.

Thanks,

Bruce


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

-- 
Ce message Envoi est certifié sans virus connu.
Analyse effectuée par AVG.
Version: 7.5.448 / Base de données virus: 268.18.11/721 - Date: 13/03/2007
16:51
 


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to