jQuery toggle content-div from menubar

Posted by nuclearsugar on Stack Overflow See other posts from Stack Overflow or by nuclearsugar
Published on 2010-12-27T07:34:38Z Indexed on 2010/12/27 8:53 UTC
Read the original article Hit count: 163

Filed under:
|
|
|

I'm having trouble getting jQuery to allow only one content-DIV to be visible at a time. So that clicking between the menu buttons (about, newsletter, contact) this will allow only one content-DIV to be visible.

--- Then the content-DIV needs to hide when the associated menu button is clicked (like it does currently).

--- Upon clicking the header 'alliteration', any content-DIVs that are open need to hide.

http://home.jasonfletcher.info/all/alliteration/index.html

 $('#collapse_about').hide();
 $('#collapse_newsletter').hide();
 $('#collapse_contact').hide();

 $('#menu1').click(function() {
  $('#collapse_about').slideToggle(400);
   return false;
  });

 $('#menu2').click(function() {
  $('#collapse_newsletter').slideToggle(400);
   return false;
  });

 $('#menu3').click(function() {
  $('#collapse_contact').slideToggle(400);
   return false;
  });

I understand that this is a pretty simple bit of code... but the form of it evades me. Any help is much appreciated.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery