I have a div that slides down when a button is clicked, and I would like to slide up the div when a user:
i would do something like this
var $doc, $panel = $('.panel-tab');
$doc = $(document);
$doc.bind("click", function(){
$panel.hide();
$doc.undbind("click");
});
$panel.bind("click", function(e){
e.stopPropagation();
});
you always close the tab on the click on the document, but you stop the event from propagation on the tab it self.
here a working example: http://jsfiddle.net/meo/TnG4E/