I would like to hide dive after the animation. Is it possible ?
I can show you code here
$(document).ready(function() {
$('button').click(function() {
var $lefty = $(this).next();
$lefty.animate({
left: parseInt($lefty.css('left'),10) == 0 ?
-$lefty.outerWidth() :
0
});
});
});
Pass a callback to
animateas the second argument. Also, you’ll need to change.next()to something else to find only the first child, and there are a few other optimizations that can be made. Your CSS is also wrong. Here’s the updated jsFiddle.