JAVASCRIPT CODE
$(document).ready(function() { $('button').click(function() { $("#slidingDiv").animate({width: 'toggle'}); }); });
CSS CODE
#slidingDiv{ width: 200px; height: 50px; background-color: red; }
<body> <button>CLICK ME</button> <br /> <div id="slidingDiv"></div> </body>