Slidetoggle horizontal - Jquery , simple horizontal right – left animation slide toggle?

17th of December 2010 0

Jquery , simple horizontal right – left animation slide toggle?

Hi all, im struggling to move a simple panel 400px to the right, and then 400px to the left. this is what i got so far:

var getWidth = $ (‘#toolbarHolder’).width() – 40;

$ (‘.btn-opentoolbar’).click(function() {

$ (‘#toolbarHolder’).animate({left: -getWidth}, 500);
return false;

});

It doesnt work though and if it works it only moves 1 direction and not to original position again on next mouse click.

I hope someone can help me
Thanks in advance
Mark

Best answer:

Answer by Mr. Bex
hi!

al you have to do is to add a toggle action, and add inside the animate action:

$ (“#tmenu”).toggle(function(){$ (‘#sbcont’).animate({left: -getWidth}, 0);}, function(){$ (‘#sbcont’).animate({left: +getWidth}, 0);});
});

for more information take a look in the API of jquery =P

good luck

What do you think? Answer below!

Filed under § jquery animate — Tagged with , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Share it!

Was it good for you to?

Sponsors

Support for the site!

No sponsors at the moment.



Your opinion matters. Add it below.


Tip: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



Copyright jqueryui.info since 2010. All rights reserved. Design and the Absolute Theme by Tommie Hansen.