<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.8.3.js'></script>
<script type='text/javascript'>
$(window).load(function(){
$('#do1').click(function() {
$('#div2').promise().done(function() {
$('#div1').toggle('slow');
});
});
$('#do2').click(function() {
$('#div1').promise().done(function() {
$('#div2').toggle('slow');
});
});
});
</script>
</head>
<body>
<button id="do1">Click</button>
<button id="do2">Click</button>
<div id="div1">Div 1</div>
<div id="div2">Div 2</div>
</body>
</html>