$('.left-sidebar').click(function(e){
var originalWidth = $(this).width();
$(this).animate({width: '0px'}, 400, linear, function(e){
$(this).hide();
});
$('.right-sidebar').animate({width: originalWidth}, 400, linear);
});
Assumptions:
- Left sidebar has class “left-sidebar”, right sidebar has class “right-sidebar”.
- The left sidebar needs to be hidden after it is animated.
Explore .animate() for customization.
1
solved Toggle and give width to another DIV [closed]