tags:

views:

45

answers:

1

I have to make something like an accordion, but I want it to fade while I click on a "li" of the menu.

http://scripts.den-style.net/

Click on "Prodotti" and then on "Chi Siamo" ;D

Can you help me?

How can I fade each "pannel"?

A: 

You can change your click function to be generic like this:

$(".menu a").click(function() {
  var id = $(this).attr("class");
  $(".container>div:visible").fadeOut("normal", function() {
     $("#" + id).fadeIn();
  });
});

Just give your other top links that don't have a class one as well so this works for all of them. This method uses the class name on the link like you already have, finds the matching ID element, fades whatever's visible out and fades only that ID element back in in.

Note: you need to remove your current code for the individual items, it will interfere with this.

Nick Craver