Since you will be toggling the div that was previously open, I assume you will only have one div toggled out at any time, you could try something like this:
$(document).ready(function(){
$( ".toggle" ).click(function() {
if ($(this).next().is(":visible"))
$(this).next().slideToggle("fast");
else {
$(".toggle").each(function() {
if ($(this).next().is(":visible"))
$(this).next().slideToggle("fast");
});
var tog = $(this).attr("data-class");
$("."+tog).slideToggle("fast");
}
});
});
So for everytime you click a div with the "toggle" class, it will iterate through all the other divs with "toggle" class, checking if it is visible, and if it is, then toggle it to close.
EDIT: Made the change to account for clicking an already toggled (shown) div, to close it. There might be a better logic/algorithm way to handle this, but currently it does "if the current list is visible, close it and move one, else if it is an unopened one, toggle the opened one and toggle the one just clicked to show".