since you are learning....

rather then click you will want to use toggle on the one state you
will move right, on the other left

http://docs.jquery.com/Events/toggle#fnfn2fn3.2Cfn4.2C...

probablye easiest tot ake your animate code and create 2 function one
for going left and on for right and fire those using toggle


On Jun 25, 11:36 am, meoluoibieng <duykhanhonl...@gmail.com> wrote:
> Dear all, I'm a newbie , glad to know you, i have read the tutorial
> about Animate Left Margin (http://www.learningjquery.com):
> The code:
> [
>    1.
>       $(document).ready(function() {
>    2.
>         $('#slidemarginleft button').click(function() {
>    3.
>           var $marginLefty = $(this).next();
>    4.
>           $marginLefty.animate({
>    5.
>             marginLeft: parseInt($marginLefty.css('marginLeft'),10) ==
> 0 ?
>    6.
>               $marginLefty.outerWidth() :
>    7.
>               0
>    8.
>           });
>    9.
>         });
>   10.
>       });
>
> ]
>
> Every thing go well but i want to click the button again, and the
> frame return to the position before ( so it slide from right, and i
> want to click the button again and it slide to left to right), my
> problem is after slide left to right , the button not work, please
> help me solve this problem, sorry because English is not the main
> language of me, thanks all;

Reply via email to