I have a div that slides down when a button is clicked, and I would like to slide up the div when a user:
- Clicks anwhere except within the DIV itself
- Click a close button within the div.
Currently I've got it to a stage where, you click an element with the class .panel-tab
- it slides down the panel with ID #panel
... click anywhere else it slides up....
Here is my code so far to get the DIV to open and close:
<script type="text/javascript">
$(document).ready(function(){
$('.panel-tab').click(function(e) {
$("#panel").stop(true, true).slideToggle("slow");
e.stopPropagation();
});
$("body").click(function () {
$("#panel:visible").stop(true, true).slideUp("slow");
});});
</script>