Check out this jsfiddle http://jsfiddle.net/Y7fEW/.
I’m trying to get the tan div on the left so that when you click it, it slides out, and when you click it again, it slides back in.
Currently when you click it, it slides out, but when you click it again, it slides out again. I followed a tutorial online to get this far, but I can’t figure it out.
$('#social').live('click', function() {
var $lefty = $(this);
$lefty.animate({
marginLeft: parseInt($lefty.css('marginLeft'), 2) == 0 ?
$lefty.outerWidth() : 0
});
});
The problem is the
parseIntfunction call:use
parseInt("...")instead ofparseInt("...", 2)check: http://jsfiddle.net/roberkules/Y7fEW/6/