expand div from onclick

by ian_smithz

HTML

<div class="drawer"></div>

<button class="some-button">
xxx
</button>

CSS

.drawer { background: red; width: 100px; height: 100px; }

JavaScript

$('.some-button').click( function() {
    var toggleWidth = $('.drawer').width() == 0 ? "100px" : "0";
    $('.drawer').animate({ width: toggleWidth });
});