Continuing ongoing animation?

Continuing ongoing animation?

Hi, I've this little slider thing or whatever you want to call it, the thing is that it stops between every animation. I want it to keep going if you click more times. Basiclly making the ongoing animation continue. I was thinking about having some sort of timer that runs as long as the animation and if you click again during that time it will continue scrolling.

In c# I could modify running processes and I was thinking it could work here too.


The code for the animation is this currently:
  1. $(document).ready(function(){
  2. var int_Tmbs = $("#thumbnail-box").children().size();
  3. var int_Counter = 2;
  4. $("a").click(function(){
  5. var str_LinkId = $(this).attr("id");
  6. if(str_LinkId == "previous-btn"){
  7. //PREVIOUS = (+) PLUS
  8. if (int_Counter < int_Tmbs-1) {
  9. int_Counter++;
  10. $("#thumbnail-box").animate({"left": "-=280px"}, 1000);
  11. }else{
  12. edgeBounce("+");
  13. }
  14. }else if(str_LinkId == "next-btn"){
  15. //NEXT = (-) MINUS
  16. if (int_Counter > 2) {
  17. int_Counter--;
  18. $("#thumbnail-box").animate({"left": "+=280px"}, 1000);
  19. }else{
  20. edgeBounce("-");
  21. }
  22. }
  23. });
  24. });
  25. function edgeBounce(bDirect){
  26. switch (bDirect) {
  27. case "+":
  28. $("#thumbnail-box").animate({"left": "-=28px"}, 300);
  29. $("#thumbnail-box").animate({"left": "+=28px"}, 300);
  30. break;
  31. case "-":
  32. $("#thumbnail-box").animate({"left": "+=28px"}, 300);
  33. $("#thumbnail-box").animate({"left": "-=28px"}, 300);
  34. break;
  35. }
  36. }