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:
- $(document).ready(function(){
- var int_Tmbs = $("#thumbnail-box").children().size();
- var int_Counter = 2;
-
- $("a").click(function(){
- var str_LinkId = $(this).attr("id");
-
- if(str_LinkId == "previous-btn"){
-
- //PREVIOUS = (+) PLUS
-
- if (int_Counter < int_Tmbs-1) {
- int_Counter++;
- $("#thumbnail-box").animate({"left": "-=280px"}, 1000);
- }else{
- edgeBounce("+");
- }
-
- }else if(str_LinkId == "next-btn"){
-
- //NEXT = (-) MINUS
-
- if (int_Counter > 2) {
- int_Counter--;
- $("#thumbnail-box").animate({"left": "+=280px"}, 1000);
- }else{
- edgeBounce("-");
- }
-
- }
- });
- });
- function edgeBounce(bDirect){
- switch (bDirect) {
- case "+":
- $("#thumbnail-box").animate({"left": "-=28px"}, 300);
- $("#thumbnail-box").animate({"left": "+=28px"}, 300);
- break;
- case "-":
- $("#thumbnail-box").animate({"left": "+=28px"}, 300);
- $("#thumbnail-box").animate({"left": "-=28px"}, 300);
- break;
- }
- }