jQuery animate() to hide and show elements by sliding left and right
I'm trying to animate something using jQuery. UPDATE I have it working the way I want it. This is the jQuery: $(document).ready(function() { // go chat button $('#go-chat input').click(function() { $('#search, #go-chat').animate({width: '0px'}, 1000, function() { $(this).hide(); $('#login, #go-search').animate({width: '573px'}, 1000, function() { $(this).show(); } ); } ); }); $('#go-search input').click(function() { $('#login, #go-search').animate({width: '0px'}, 1000, function() { $(this).hide(); $('#search, #go-chat').animate({width: '573px'}, 1000, function() { $(this).show(); } ); } ); });