Problem with toggle/animate
- function LeftBut(){
- $('#textleft').animate({'width': 'toggle'}, { duration: 1000,});
- //This one over works as supposed, have even tried without it, but wanted to post the whole function.
-
- $('#textleftbutton').toggle(
-
- function()
- {
- $('#textleftbutton').animate({left: '+=350'}, 1000);
-
- },
-
- function()
- {
- $('#textleftbutton').animate({left: '-=350'}, 1000);
-
- }
-
- );
- }
Everytime I press the button the animation stacks like this;
1. Moves to right.
2. Moves left to right.
3. Moves right to left to right.
4. Moves left to right to left to right.
5. Moves right to left to right to left to right side.
Would appreciate it really much if someone could help me.
Thanks in advance
Edit: Did see i missed a +, but that isn't the problem.
What i want it do to:
Click once go to 350px at right
Click at it when it is on right side, go back to where it started