I want to move button left-right and right-left using jquery

前端 未结 5 1334
执笔经年
执笔经年 2021-01-24 06:11

I am able to move button to left side but after that how i can again move it to right side. Can i also use delay here.

Here is the code that i have tried:



        
5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-24 07:01

    Cannot answer properly without looking at your HTML and CSS but what you are doing is right. Simply call your example_animate() with a negative value

    i.e.

    example_animate(-10);
    

    Or if you want to bring it to the original value (assuming originally it had 0 margin)

    example_animate(0);
    

    Note: This is probably not the best way to animate

提交回复
热议问题