toggle slide open hidden div and slide close open divs at same time
Trying to learn the basics... Here is a script for three toggle buttons that each when clicked open their corresponding divs. Fine. Now how does one go about automatically closing an open div when clicking on a new 'toggler' that opens it's div? I see other posts about this very question, but I'm just not grasping the logic.
jQuery(document).ready(function($) {
$("#toggle1").click(function () {
$("#toggle1div").toggle("drop", {direction:"right"}, 500);
});
$("#toggle2").click(function () {
$("#toggle2div").toggle("drop", {direction:"right"}, 500);
});
$("#toggle3").click(function () {
$("#toggle3div").toggle("drop", {direction:"right"}, 500);
});
});