ThomasCS ThomasCS - 17 days ago 12
HTML Question

jquery .slideToggle() horizontal alternative?

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

You can use the animate method:

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

http://jsfiddle.net/7ZBQa/