I am trying to create a basic a accordian style menu. Im guessing i have done 90% of the code, but a little stuck now.

I have three widget and what I am attempting to do is hide all the widgets apart from the one actually clicked. My code so far is as follows.

$(".widget-title").click(
		function () {
		  $("#widget1_content").hide(); //My Widgets
		  $("#widget2_content").hide();
		  $("#widget3_content").hide();
		  $(this).parent().next().toggle(); // Toggle the Content Box
		  $(this).parent().parent().toggleClass("closed-widget"); // Toggle the class "closed-widget"
		  $(this).parent().find(".content-box-tabs").toggle(); // Toggle the tabs
		}
	);

Any help would be appriciated.

Recommended Answers

You want the javascript/ajax forum: http://www.daniweb.com/web-development/javascript-dhtml-ajax/117

This is php.

//By hide, you mean as in 'disappear' or 'close' (roll up). If they 'disappear' how do you get them back again?

Jump to Post

All 2 Replies

oops

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.