I'm curious about how to accomplish this using JQuery. I have a menu where each item must have a unique class name in order for the CSS to properly display a sprite background position shared by all items. When an item is clicked, I also need to activate a unique active state class name. What would be the most efficient approach to achieve this? Below is my code:
HTML
<div id="menu">
<a href="javascript:void(0);" class="trailer">Trailer</a>
<a href="javascript:void(0);" class="bios">Bios</a>
<a href="javascript:void(0);" class="photos">Photos</a>
<a href="javascript:void(0);" class="synopsis">Synopsis</a>
<a href="javascript:void(0);" class="news">News</a>
</div>
CSS
#menu a { background: url(../images/menu.png) no-repeat; height:16px; overflow:hidden; display:block; text-indent:-10000px; float:left; margin-left:63px;}
#menu a:first-child { margin-left: 0;}
#menu a.trailer { width: 91px;}
#menu a.trailer:hover, #menu a.trailer_active { background-position: 0px -20px;}
#menu a.bios { width: 50px; background-position: -153px 0;}
#menu a.bios:hover, #menu a.bios_active { background-position: -153px -20px;}
#menu a.photos { width:86px; background-position: -272px 0;}
#menu a.photos:hover, #menu a.photos_active { background-position: -272px -20px;}
#menu a.synopsis { width:103px; background-position: -423px 0;}
#menu a.synopsis:hover, #menu a.synopsis_active { background-position: -423px -20px;}
#menu a.news { width:62px; background-position: -579px 0;}
#menu a.news:hover, #menu a.news_active { background-position: -579px -20px;}