Here is a post that shows how to do this. Link The following jQuery can be placed in a content editor webpart or on the masterpage, which is how I implemented it.
function makeHeaderCollapsible() {
$("div.menu-vertical>ul.root>li.static>ul.static").css("display", "none");
$("div.menu-vertical>ul.root>li.static>span.static").toggle
(
function () {
$(">ul", $(this).parent()).show("fast");
},
function () {
$(">ul", $(this).parent()).hide("fast");
}
);
$("div.menu-vertical>ul.root>li.static>ul").css("display", "none");
};
I have a script that calls the above method once the page loads.
$(makeHeaderCollapsible);
I also needed an additional method to keep the menu section open if the current page is in that section. SharePoint provides help for finding this by marking the menu item with the 'selected' class. The following code was added at the end of the makeHeaderCollapsible method to open the selected section again.
$("div.menu-vertical>ul.root>li.static>ul.static>li.selected").parent().css("display", "block");