You can set the position as relative then also animate the left
property, like this:
$("a#slick-toggle").click(function() {
var sb = $("#slickbox").stop(true, true), w = sb.is(":visible") ? sb.width():0;
sb.animate({width: "toggle", height: "toggle", left: w}, 1000);
});
You can give it a try here, what this does is grab the .width()
of the element and moves it that far to the left in the animation, giving the effect of it collapsing to the right, rather than the left. The .stop(true, true)
portion is to prevent animation queue-up and that .width()
is the appropriate value when going to access it (not a mid-animation width).