slideToggle - more efficient way to write?
Here's my test page:
http://circleatseven.com/projects/_Design_Assets/Snippets/Jquery/jcarousel/index.html
.. While this page works just fine.. I know this isn;t the most efficient way to do this. I have written individual functions to toggle each of the 12 buttons in the carousel... So, if I want to add more items to that carousel - I then have to add more code like so:
- $('a.linkone').click(function() {
- $('.one').slideToggle(400);
- $(".linkone").addClass("current");
- });
- $('a.linktwo').click(function() {
- $('.two').slideToggle(400);
- $(".linktwo").addClass("current");
- });
- $('a.linkthree').click(function() {
- $('.three').slideToggle(400);
- $(".linkthree").addClass("current");
- });
... and so on......
Is there a more efficient way to write this so I don't have to do this?
Thanks in advance!