.cause any open details div to close when another details div opens?

$(document).ready(function() {

$('div.calendar').find('div.details').hide().end().find('table.clickme').click(function()
 {
                var answer = $(this).next();
                if (answer.is(':visible')) {
                answer.slideUp();
                } else {
                answer.slideDown();
                }
});

});

This has been working great to open a div with details when
a table is clicked (yes, I'm using a complete table for the info because
it animates more smoothly than a row).

However, now I'd like for an open div to slide up when another
table is clicked is slide down a new div.  In other words, have only
one open details div at a time.

Perhaps I should add a class to a details div when it slides down (opens) 
called "open"
and then change the class to "closed" when another table is clicked and then 
cause
any details div's with the newly assigned "closed" class to slide up (close)?

If so, can this new approach be integrated into the code above or does the
code need to be rewritten?

Suggestions?

Rick

Reply via email to