$(document).on('click',function(e)
{
if(!$(e.target).is('#toppanel')){
e.stopPropagation();
$("div#panel").slideUp("slow");
}
});
update..(not ta good way i think..anyway give a try) give all the elements a class that you want to exclude the click event
<div class="exclude">
<p class="exclude"></p>
<span class="exclude">fooo</span>
etc....
</div>
$(document).on('click',function(e)
{
if(!$(e.target).is('.exclude')){
e.stopPropagation();
$("div#panel").slideUp("slow");
}
});