jquery .slideToggle() horizontal alternative?

ThomasCS picture ThomasCS · Jan 23, 2013 · Viewed 80.6k times · Source

slideToggle does exactly what I want, only I want the slide to be horizontal.

I now have an horizontalhide/show and animation on click, but I would like to have the toggle options. So that when I click on the active link, it will play the animation reversed and hide itself.

What would be the best way to do this?

Answer

undefined picture undefined · Jan 23, 2013

You can use the animate method:

$('#element').animate({width: 'toggle'});

http://jsfiddle.net/7ZBQa/