$(document).ready(function() { var open = false; $(":image").click(function() { $('#game').animate({height: (open ? "-": "+") +"=300"}, 1000); open = !open; }); });